C Program to read a file with getc using while loop
#include<stdio.h>
#include<conio.h>
void main()
{
FILE *fp;
char ch;
clrscr();
fp=fopen("abc.txt","r");
while(EOF!=(ch=getc(fp)))
{
printf("%c",ch);
}
getch();
}
#include<conio.h>
void main()
{
FILE *fp;
char ch;
clrscr();
fp=fopen("abc.txt","r");
while(EOF!=(ch=getc(fp)))
{
printf("%c",ch);
}
getch();
}
Comments
Post a Comment