stringstream
and Conversionscout
, cerr
, and cin
cout
and cerr
are output streams
int i; double d; cout << "Hello" << i << d;converts
i
and d
to string
s prior to sending them to the standard output
class MyClass { ... friend ostream &operator <<(ostream &os, const MyClass &myClass); ... }This operator effectively converts the
MyClass
object, myClass
to a string and sends (prints/outputs) the result to the ostream
object, os
.
cin
is an input stream
int i; double d; cin >> i >> d;converts the input (which are strings) to integer and double
fstream
(file stream), one adds files to the mix
ifstream
, and ofstream
istringstream
- allows input from string source
ostringstream
- allows output to string sink
stringstream
- allows input/output from the same stream
ostringstream
cout
<<
operator
string
for output
str()
function
istringstream
cin
operator
stringstream
<<
>>