Using get() with no parameters.
#include <iostream> using namespace std; int main() { char ch; while ( (ch = cin.get()) != EOF) { cout << "ch: " << ch << endl; } cout << "\nDone!\n"; return 0; }