1,194 questions
5 votes
1 answer
148 views
std::ostringstream 2GB cap on Windows?
I paste below a minimal example that writes to an std::string and also to an std::ostringstream object, 0.5GB at a time, then queries and prints their sizes at each step. When executing on Windows (64-...
0 votes
1 answer
156 views
How to load a TStringStream from database with DBConnection set to UTF-8 charset?
We are changing the database connection settings for our project from WIN1252 to UTF8. (FireDAC). It is a PostgreSQL database created with UTF-8 encoding. There are some text fields that we load from ...
2 votes
1 answer
60 views
std::istreambuf_iterator equality when using seekg
I am puzzled by the output of the code below: std::string content = "abcdefghijklmnopqrstuvwxyz1234567890"; std::istringstream iss(content); iss.seekg(10); std::istreambuf_iterator<char&...
2 votes
1 answer
171 views
Force std::stringstream to use \r\n as line ending
I'm adding some lines into a std::stringstream with stream << "content" << std::endl. Then I'm getting the content by stream.str(). If added a line with std::endl into a std::...
4 votes
1 answer
201 views
Why can't chrono::parse parse a POSIX date and time string?
I'm trying to use the <chrono> library to parse a POSIX date and time string, no matter what the global locale is, based on this code: #include <iostream> #include <locale> #include &...
0 votes
1 answer
75 views
why does istringstream fails specifically on the first input
Trying to sum all rows and cols (valid doubles only) of the following file by making a vec of vecs out of it and then using an istringstream to validate doubles: 18,459,45A,AG7,490,486 4A 2,65,-87,432,...
1 vote
1 answer
90 views
How to handle invalid type in std::stringstream?
I have a code #include <iostream> #include <sstream> using namespace std; int main() { stringstream ss("123 ab 4"); int a, b, c; ss >> a; ss >> b; ...
0 votes
2 answers
111 views
What is the simplest way of retrieving the last element of a stringstream? [duplicate]
I am writing a Book class as a exercise from the C++ book I am reading. I want to store the last name of an Author for sorting all of the books. So lets say the author is named: "Albert Ein Stein&...
0 votes
0 answers
59 views
How to place a string value to a tkinter text box? String value comes from another function
def selection_changed(self,event): global change_val selection = self.TCombobox1.get() get_sel_val = selection.split('=') cur_sel_val = get_sel_val[1] get_cur_val = selection....
-1 votes
2 answers
107 views
Boolean testing vs exception in stringstream [closed]
I want to short-circuit when an I/O operation on a std::istringstream/std::ostringstream fails, to avoid unnecessarily calling the rest of any chained <</>> operators on the already failed ...
1 vote
1 answer
90 views
How does the extraction operator ">>" know when to stop extraction?
The question is the same as the title, when using the extraction operator ">>" for the string " Hello World" There are 3 leading whitespace characters, and after "...
1 vote
1 answer
187 views
Out of scope issue? [duplicate]
I am using a framework that has been working for years on CentOS 7. We are migrating it to RHEL 8 and a few of the unit tests are failing. One in particular involves junk getting returned from what() ...
6 votes
2 answers
199 views
How to insert NULL character in std::wstringstream?
I need to construct a multi-string (REG_MULTI_SZ) in C++ from a list of values represented in a std::vector<std::wstring>. This is what first came to mind but was of course incorrect: std::...
0 votes
0 answers
65 views
Reading hex data from a .bin file returns FFs at the start of the string
I am trying to read the HEX data of a .bin file to a string. At the start of the string there is a bunch of FFs and after that the actual data starts. I want to only read the data that the .bin file ...
2 votes
5 answers
936 views
How to overload operator<<(double const&) in an inherited std::stringstream?
I would like to overwrite the operator<< such that: double d = 3.0; mycustomstringstream << "Hello World " << d << "what a nice day."; std::cout << ...