fork download
  1. #include <iostream>
  2. #include <sstream>
  3. #include <string>
  4. using namespace std;
  5.  
  6. int main() {
  7. stringstream sstream;
  8. sstream.write("foo\0bar", 7);
  9. string str;
  10. sstream >> str;
  11. cout << str;
  12. }
Success #stdin #stdout 0.01s 5296KB
stdin
Standard input is empty
stdout
foobar