#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
main()
{
FILE *fp;
char c;
clrscr();
//Opening the file
fp=fopen("filename","r"); //"r" is for read only mode
if(fp==NULL)
{
printf("Cannot open the file");
exit(0);
}
while(c!=EOF)
{
//Getting character from file
c=getc(fp);
printf("%c",c);
}
fclose(fp); //closing the file
getch();
}
0 comments:
Post a Comment