Write a C program to display the contents of a file.
Program Code:
#include<stdio.h>
void main()
{
FILE *fp;
char ch;
fp=fopen("file.txt","r");
if(fp==NULL)
{
printf("file opening problem");
return;
}
while(!feof(fp))
{
ch=fgetc(fp);
printf("%c",ch);
}
fclose(fp);
}
Post A Comment:
0 comments: