Posts

Showing posts from May, 2018

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"