Table of Contents
Previous Section Next Section

stringstream, istringstream, and ostringstream

#include <sstream>explicit stringstream(ios::openmode mode = ios::in | ios::out); 
explicit stringstream(const string &str,
                      ios::openmode mode = ios::in | ios::out); 

explicit istringstream(ios::openmode mode = ios::in);
explicit istringstream(const string str, ios::openmode 
                       mode = ios::in);

explicit ostringstream(ios::openmode mode=ios::out);
explicit ostringstream(const string str, ios::openmode 
                       mode = ios::out);

The stringstream( ), istringstream( ), and ostringstream( ) functions are the constructors of the stringstream, istringstream, and ostringstream classes, respectively. These construct streams that are tied to strings.

The versions of stringstream( ), istringstream( ), and ostringstream( ) that specify only the openmode parameter create empty streams. The versions that take a string parameter initialize the string stream.

A related function is str( ).


Table of Contents
Previous Section Next Section