LearnFrenzy
Sign in Take a free test

C Input / Output · Input/Output MCQ · Question 6

Which fopen() mode appends to a file? Answer, explanation & discussion

  • MCQ
  • Easy
  • 0 comments
  • Answer explained
  • Moderated community
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!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links