C Programming - Input / Output - Discussion
Discussion Forum : Input / Output - General Questions (Q.No. 6)
6.
Which files will get closed through the fclose() in the following program?
#include<stdio.h>
int main()
{
FILE *fs, *ft, *fp;
fp = fopen("A.C", "r");
fs = fopen("B.C", "r");
ft = fopen("C.C", "r");
fclose(fp, fs, ft);
return 0;
}
Answer: Option
Explanation:
Extra parameter in call to fclose().
Discussion:
27 comments Page 2 of 3.
Leenaja said:
1 decade ago
To close all the files opened with fopen()at a time, we can use file function closeall(). This function has no arguments.
Aakash said:
1 decade ago
fclose() can close only one file at a time. If more than 1 argument than it will take only first and ignore rest.
Kumar harsh said:
1 decade ago
Can any body tell when fclose (a, b, s) is false then is it true return (a, b, c)?
Please tell me in detail.
Please tell me in detail.
Pranathi said:
8 years ago
'fclose()' takes only one argument at a time i.e it can't be used to close multiple opened file at a time.
(3)
R. rajkumar... said:
1 decade ago
Can we close some selected file at a time from the many no of files by use of fclose or any other method?
Ashwini said:
1 decade ago
M getting segmentation fault even though m passing 1 parameter to it, can any 1 fix this problem?
Yogesh thuwal said:
1 decade ago
While fclose() read only one argument. Then we pass to the 3 files that time it will close 1 one.
Pratyush sharma said:
3 years ago
Option D will be the Right answer because you can not pass more than one argument in function.
(1)
Silome jain said:
1 decade ago
Please tell about all file function, why we use it, what its purpuse to use.
Shilpa said:
1 decade ago
We can use fcloseall(); then all the opened files will be closed.
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers