C Programming - Input / Output - Discussion


Which of the following operations can be performed on the file "NOTES.TXT" using the below code?

FILE *fp;
fp = fopen("NOTES.TXT", "r+");

[A]. Reading
[B]. Writing
[C]. Appending
[D]. Read and Write

Answer: Option D


r+ Open an existing file for update (reading and writing).

Sneha said: (Aug 16, 2011)  
What does updating mean?

Akash said: (Sep 20, 2011)  
Update means changing the value of variable.

Varsha said: (Oct 25, 2014)  
What does appending mean?

Aman said: (Apr 4, 2015)  
Answer is wrong.

r+ is used for reading, opening if not present and appending.

Bally said: (Feb 17, 2016)  
What is the correct answer for this question?

Charan said: (Feb 27, 2016)  
Correct answer is option D: Read and Write.

Sush said: (May 7, 2017)  
Why can't we use r++?

Post your comments here:

Name *:

Email   : (optional)

» Your comments will be displayed only after manual approval.