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();
}

Note- The above file contains word "hello"

Comments

Popular posts from this blog

Java Program to print any matter

Line

putpixel in c