// File: Buffer2.cpp // Demonstrate full vs. line buffering. Check when things come out! // Write a string to cout. If run with output redirected, should appear twice! // Try it any way without \n // Try changing cout to cerr #include #include #include using namespace std; int main() {pid_t pid; cout << "ABCD\n"; if (pid=fork()) { wait(NULL); cout << "Parent!\n"; } else cout << "Child!\n"; cout.flush(); }