Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- getting information from standard output ( C )?
- string s;
- fstream fs("/dev/stdout", fstream::in);
- fs >> s;
- cat file_with_nulls
- cat file_with_nulls > otherfile
- ./myprog > output.bin
- char cstr[] = { 'H', 'e', 0, 'l', 'l', 'o', 0 };
- std::string s1(cstr); // wrong, gives you "He"
- std::string s2(cstr, sizeof(cstr)); // correct
- std::string result;
- std::fstream fs( "/dev/stdout", std::fstream::in|std::fstream::binary );
- while ( !fs.eof() ) {
- std::string b;
- fs >> b;
- result += b;
- }
- fs.close();
- std::fstream out( "C:\tmp\test1.txt", std::fstream::out );
- out.write( "aaan bbb ccc", 13 );
- out.close();
Add Comment
Please, Sign In to add comment