Module 13 · Files
The Interview Angle: Buffering, Flushing and the Output That Vanished
ProReading
Kenji's stock program crashes somewhere in the middle. To find where, he puts one line above the line he suspects: printf("before the crash\n");. The Playground shows the badge Runtime error and an empty output box.
Checking what this lesson needs for you…
What is inside The Interview Angle: Buffering, Flushing and the Output That Vanished
- Kenji's line ran, and never arrived
- Three buffering modes, and who gets which
- Why the Playground waits for 4,096 bytes
- fflush sends the buffer now
- setvbuf chooses the mode
- stderr is separate, and never fully buffered
- How a program ends decides what survives
- The questions interviewers ask