Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 4

C Input and Output

In the following code


#include <stdio.h>
int main(void) {
FILE *fp;
fp = fopen(“trial”, “r”);
return 0;
}
fp points to
• The first character in the file
• The structure which contains a char pointer which points to
the first character in the file
• The name of the file
• None of the above
Point out the error, if any, in the following program
#include <stdio.h>
int main(void) {
unsigned char ch;
FILE *fp;
fp = fopen(“trial”, “r”);
while ((ch = fgetc(fp)) != EOF)
printf(“%c”, ch);
fclose(fp);
return 0;
}
Which of the followings is not an ANSI
compatible file opening function?
• fopen
• freopen
• open
• tmpfile

You might also like