24.6 oesstream

These classes provide a mechanism to read from and write to strings of data. The oeisstream is capable of wrapping and reading from a std::string as well as a simple memory buffer. The oeosstream writes directly to an internal string of which a copy can be accessed at any time.

std::string str = "hello world!"

oeisstream ois(str);
oeosstream oos;

if (ois)
{
    std::string buffer;
    while (ois.getline(buffer))
        oos << buffer;
    oos << "!dlrow olleh" << oeendl;
}

str = oos.str();