← Quiz: Files and Preprocessor: all 10 questions
Quiz: Files and Preprocessor · Question 10 of 10
Why should you call fclose when you have finished with a file?
Why should you call fclose when you have finished with a file?
- A.To delete the file
- B.To flush any data still in the buffer to disk and release the file
- C.To move back to the start of the file
- D.fclose is only needed for binary files
Answer & explanation
Correct answer: To flush any data still in the buffer to disk and release the file
Without fclose, the last writes may stay in memory and never reach the file if the program ends abnormally.
Can you get the rest right without peeking?
Take the timed Quiz: Files and Preprocessor quiz free. Pass it to earn XP and count towards your certificate.
Start the quiz →