Q: My program's prompts and intermediate output don't always show up on the screen, especially when I pipe the output through another program.
A: It's best to use an explicit fflush(stdout) whenever output should definitely be visible (and especially if the text does not end with \n). [footnote] Several mechanisms attempt to perform the fflush for you, at the ``right time,'' but they tend to apply only when stdout is an interactive terminal. (See also question 12.24.)
ISO Sec. 18.104.22.168