Skip to content

Instantly share code, notes, and snippets.

@hotwatermorning
Created February 11, 2020 15:43
Show Gist options
  • Save hotwatermorning/bda9a9b51ce702c5ee2fee5da811177f to your computer and use it in GitHub Desktop.
Save hotwatermorning/bda9a9b51ce702c5ee2fee5da811177f to your computer and use it in GitHub Desktop.
unseekable stream test
//https://wandbox.org/permlink/WDyGG2FRC7FNuoXy
#include <iostream>
int main()
{
// unseekable stream test
std::ostream &os = std::cout;
printf("initial state: %d\n", std::cout.fail());
os << "hello world" << std::endl;
printf("after output: %d\n", std::cout.fail());
os.tellp();
printf("after tellp: %d\n", std::cout.fail());
os.seekp(10, std::ios::beg);
printf("after seekp: %d\n", std::cout.fail());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment