* How does stringstream work?
Someone kind of explained it like, in cout it sends it to "standard out stream" or something, and using stringstream, you stream it into that instead.
stringstream a; int b=12; a << b;
* How can it convert characters into int and such?
char a = '2'; int b; stringstream c; c << a; c >> b; //now b = 2
* How does this work?
stringstream(someInt) >> out;
someInt is just a regular int.
Does it turn it into a stringstream.. or does it just somehow use it without turning it into a stringstream?
If it does turn it into a stringstream, does it mean someInt can no longer be used as an int?
like skipping over the stringstream varName(someInt)?
* Where does the garbage value come from?
string a1="13", a2="25"; int b,c; stringstream d; d << a1; d >> b; //it works if i put d.clear() here, //but still wondering where that garbage value //came from d << a2; d >>c;
c produces some garbage value, but where is that garbage value coming from?
I can understand a pointer pointing somewhere random, getting a garbage value, but this?
25 -> d -> c. I don't get it?
Edited 5 Years Ago by sha11e: n/a