-
-
Save artemp/45d5d82ed5696978e7c4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <sstream> | |
int main(int argc,char** argv) | |
{ | |
std::ostringstream out; | |
char * str = "ABCD-"; | |
out.write(str,5); | |
out.write(str,5); | |
out.write(str,5); | |
std::cerr << out.tellp() << std::endl; | |
std::cerr << "seek 5" << std::endl; | |
out.seekp(5, std::ios::beg); | |
std::cerr << out.fail() << " " << out.good() << " " << out.eof() << std::endl ; | |
std::cerr << out.tellp() << std::endl; | |
std::cerr << "seek 15" << std::endl; | |
out.seekp(15,std::ios::beg); | |
std::cerr << out.fail() << " " << out.good() << " " << out.eof() << std::endl ; | |
std::cerr << out.tellp() << std::endl; | |
std::cerr << "seek 25" << std::endl; | |
out.seekp(25, std::ios::beg); | |
std::cerr << out.fail() << " " << out.good() << " " << out.eof() << std::endl ; | |
std::cerr << out.tellp() << std::endl; | |
std::cerr << "seek 10" << std::endl; | |
out.seekp(10, std::ios::beg); | |
std::cerr << out.fail() << " " << out.good() << " " << out.eof() << std::endl ; | |
std::cerr << out.tellp() << std::endl; | |
std::cerr << out.str() << std::endl; | |
return EXIT_SUCCESS; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
clang version 3.3 (179091)
Target: x86_64-apple-darwin12.3.0
Thread model: posix