Govt. Exams
Entrance Exams
Advertisement
Topics in C Programming
Which function writes formatted data to a file?
Correct Answer:
A. fprintf()
EXPLANATION
fprintf() writes formatted data to a file, similar to printf() but with a file pointer as the first argument.
What does fgets() function do?
Correct Answer:
A. Reads a line from a file
EXPLANATION
fgets() reads a string from a file until a newline character or end of file is encountered. It takes three arguments: buffer, size, and file pointer.