Created
February 11, 2020 15:43
-
-
Save hotwatermorning/bda9a9b51ce702c5ee2fee5da811177f to your computer and use it in GitHub Desktop.
unseekable stream test
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
//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