Here you will get C program to read file line by line.
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.
Program
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
int main()
{
FILE *fp;
char ch;
fp = fopen("hello.txt","r");
if(fp == NULL)
{
printf("File not found. \n");
}
else
{
printf("File is opening..... \n\n");
while((ch = fgetc(fp)) != EOF )
{
printf("%c", ch);
}
}
fclose(fp);
return 0;
}
Output

