Friday, October 30, 2009

C++ String Streams

C++ String Streams

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

Three main classes are available in :

  • 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:

Constructorscreate new string streams
Operatorsread from and write to string streams
rdbufget the buffer for a string stream
strget or set the stream's string

No comments:

Post a Comment

Popular Posts