Streams
A stream is an infinite data stream on which you can push or pull data. String streams and file streams enable strings and files to interact with the stream directly.
String Streams
String streams need the header <sstream>
. They are not connected to an input or output stream and store their data in a string.
Whether you use a string stream for input or output or with the character type char
or wchar_t
there are various string stream classes:
-
std::istringstream
andstd::wistringstream
- String stream for the input of data of type
char
andwchar_t
. -
std::ostringstream
andstd::wostringstream
- String stream for the output of data of type
char
andwchar_t
. -
std::stringstream
andstd::wstringstream
- String stream for the input or output of data of type
char
andwchar_t
.
Typical operations on a string stream are:
- Write data in a string stream:
- Read...