C++ String Streams [C++ Reference]
Keywords: io,sstream,start
Date: 2009-04-15T08:41:10-0700

[[C++ String Streams]]
C++ Reference
Translations of this page?:

- en
- br-pt
- cn
- fr
- it
- jp
- pl
- ru
- tr

# C++ String Streams

String streams are similar to the <iostream> and <fstream> libraries, except that string streams allow you to perform I/O on strings instead of streams. The <sstream> library provides functionality similar to sscanf and sprintf in the standard C library.

Three main classes are available in <sstream>:

- stringstream - allows input and output
- istringstream - allows input only
- ostringstream - allows output only

String streams are actually subclasses of iostreams, so all of the functions available for iostreams are also available for stringstream. See the C++ I/O functions for more information.

In addition, string streams also supply the following functions:

Constructors | create new string streams
Operators | read from and write to string streams
rdbuf | get the buffer for a string stream
str | get or set the stream's string

Edit this page • Old revisions
• • • Login • Index • Recent changes • RSS • cc •