<<< | Index | >>> |
#include <cassert> #include <string> #include <sstream> int main() { const double PI = 3.1415926; double value; std::stringstream buffer; // text buffer buffer.precision( 8 ); // increase default precision buffer << PI; // formatted output buffer >> value; // formatted input assert( PI == value ); std::string text; text = buffer.str( ); // returns std::string buffer.str( "" ); // clear buffer return 0; }
<<< | Index | >>> |