Question 6
Back to Exercise
You want to add log lines to the end of a file, creating it if it does not exist. Which mode?
- A "r"
- B "w"
- C "a" Correct
- D "r+"
Correct Answer: Option C
"a" creates the file if needed, and every write goes to the end even after an fseek. "w" would destroy the existing contents; "r" and "r+" fail if the file is missing.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!