How do you print an istream variable to standard out. [EDIT] I am trying to debug a scenario wherein I need to ouput an istream to a log file
This will print the whole stream, 1 character at a time:
char c; c = my_istream.get(); while (my_istream) { std::cout << c; c = my_istream.get(); }
This will print the whole thing, but discard whitespace:
std::string output; while(my_istream >> output) std::cout << output;