In below program we first open a demo file hello.txt with some text in read mode. Make sure the file is already present. Then we read the file character by character and display on screen.
fp = fopen(“hello.txt”,“r”);
if(fp == NULL)
printf(“File not found. n”);
printf(“File is opening….. nn”);
while((ch = fgetc(fp)) != EOF )