Match the following with respect to I/O classes in object oriented programming :
Match the following with respect to I/O classes in object oriented programming :
List-I
(A) fopen()
(B) fclose()
(C) ferror()
(D) feof()
List-II
(i) returns end of file
(ii) return for any problem report
(iii) returns 0
(iv) returns a file pointer
Codes : A B C D
Show answerHide answer
Correct answer: (A) iv i ii iii
Explanation
Fopen() : creates a file or opens an existing file and returns a file pointer, e.g. FILE ∗fp; fp = fopen("<file-name>", "<mode>"); fclose() : closes a file; returns 0 on success and EOF otherwise. ferror() : checks the error indicator for the given file stream, returning non-zero if set and 0 otherwise. feof() : checks the end-of-file indicator for the given file stream, returning non-zero if set and 0 otherwise.