#include using namespace std; // copy stdin to stdout // description of cin functions @ http://www.cplusplus.com/ref/iostream/istream/ int main() { do { char c = cin.get(); // get one character from stdin if (!cin.good()) break; // exit loop if error or end-of-file cout << c; // if good, append c to stdout } while (true); // continue forever }