Im a bit confused about stringstream and I wana get it right. I understood it that its the same thing as function atoi in C. Am i right? And if im not pls explain it to me. Tnx :)
Anything you can do with an istream or an ostream, you can do with an stringstream.
stringstreams can be useful for parsing input from a getline operation. Or they can be used to build a complex string using output operators.
1 2 3 4
FOO foo; // FOO overloads the << operator
stringstream ss;
ss << foo; // Write FOO to the stringstream. FOO doesn't know or care that we're using a stringstream.
cout << ss.str() << endl; // Output the accumulated string