# **[](https://en.cppreference.com/w/cpp/header/sstream)** provides `std::istringstream`, `std::ostringstream`, and `std::stringstream` for in-memory string I/O. Use them to parse or format strings with the iostream interface. They're slower than direct string manipulation or `std::format`, but are useful for portable formatted I/O without file overhead. ## Example This example uses istringstream to parse a formatted input string and ostringstream to compose a formatted output string. ```cpp // compile: g++ -std=c++11 -o sstreamexample sstreamexample.cpp // run: ./sstreamexample // description: parse and format strings #include #include #include int main() { std::istringstream iss("42 3.14 hello"); int i; double d; std::string s; iss >> i >> d >> s; std::cout << "parsed: " << i << ", " << d << ", " << s << "\n"; std::ostringstream oss; oss << "result: " << (i + 100); std::cout << oss.str() << "\n"; return 0; } ```