Linked Questions
32 questions linked to/from How do you clear a stringstream variable?
140
votes
1
answer
98k
views
How to clear stringstream? [duplicate]
stringstream parser;
parser << 5;
short top = 0;
parser >> top;
parser.str(""); //HERE I'M RESETTING parser
parser << 6; //DOESN'T PUT 6 INTO parser
short bottom = 0;
parser >&...
119
votes
1
answer
111k
views
How to clear ostringstream [duplicate]
ostringstream s;
s << "123";
cout << s.str().c_str() << endl;
// how to clear ostringstream here?
s << "456";
cout << s.str().c_str() << endl;
...
106
votes
3
answers
88k
views
resetting a stringstream [duplicate]
How do I "reset" the state of a stringstream to what it was when I created it?
int firstValue = 1;
int secondValue = 2;
std::wstringstream ss;
ss << "Hello: " << firstValue;
std::...
5
votes
3
answers
24k
views
how to clear the content in the String stream.? [duplicate]
can any one tell me how to clear the content of the stringstream..?
i tried the following but it didnt work.
stringstream ss;
ss<<"bala"<<"murugan";
cout<<ss.str(); //Output ...
3
votes
1
answer
382
views
Extra character from StringStream to String in C++ [duplicate]
I was writing a code in C++ 11 that would read some lines and print the first word of each line. I decided to use getline and stringstream.
string line, word;
stringstream ss;
while(somecondition){
...
0
votes
1
answer
250
views
C++ outputstream remove stored data [duplicate]
At the moment I am storing some data into an output stream like so
std::ostringstream oss;
std::string fileData;
for(int i = 0; i < 4; i++)
{
oss << i;
fileData += oss.str();
}
now ...
1
vote
1
answer
122
views
Change variable text [duplicate]
Possible Duplicate:
In C++, how do you clear a stringstream variable?
I have a problem with a string i want to use to display in my loop.
I set it up like this in my loop:
//while {
std::...
0
votes
0
answers
179
views
Clearing a String Stream [duplicate]
How do I clear a string stream. I am tokenizing a file line by line, and the stringstream is global. I can tokenize the first line, but I can't get the second line working
stringstream currentLine;
...
0
votes
0
answers
84
views
stringstream >> operator does not take the next line [duplicate]
void fill() {
ifstream fin;
fin.open(File);
if (!fin) {
throw std::runtime_error("unable to open file");
}
char line[maximumCodeLine];
std::stringstream stream;
string letter;
string code;
while(...
122
votes
4
answers
61k
views
How to reuse an ostringstream?
I'd like to clear out and reuse an ostringstream (and the underlying buffer) so that my app doesn't have to do as many allocations. How do I reset the object to its initial state?
48
votes
5
answers
22k
views
Why is istream/ostream slow [duplicate]
At 50:40 of http://channel9.msdn.com/Events/GoingNative/2013/Writing-Quick-Code-in-Cpp-Quickly Andrei Alexandrescu makes a joke about how not efficient/slow istream is.
I had an issue in the past ...
23
votes
7
answers
44k
views
how to reuse stringstream
These threads do NOT answer me:
resetting a stringstream
How do you clear a stringstream variable?
std::ifstream file( szFIleName_p );
if( !file ) return false;
// create a string stream for parsing
...
41
votes
1
answer
46k
views
Best way to empty stringstream?
One of the possibilities is:
somestringstream.str("");
But is it most optimal? Is there any way to preserve stringstream internal buffer, so that following operator<<() calls would not require ...
6
votes
3
answers
11k
views
‘std::ostream’ has no member named ‘close’
std::ostream has no member function close(). What type of stream should I not be allowed to close?
As an example, maybe I would like to close std::cout in order to prevent any further writing to it.
...
5
votes
2
answers
9k
views
Parsing a CSV file - C++
C++14
Generally, the staff in university has recommended us to use Boost to parse the file, but I've installed it and not succeeded to implement anything with it.
So I have to parse a CSV file line-...