For efficiency, writing to files under Unix is usually buffered, so
printf(....) might not immediately produce bytes at stdout.
Should your program crash soon after a printf() command you
might never see the output.
If you want to force synchronous output you can
Use stderr (which is usually unbuffered) instead of stdout.
Use fflush(stdout) to flush out the standard output buffer.
Use setbuf(stdout,NULL) to stop standard output being buffered.