C Program to Read content of a File and Display it
Below is a simple program to read the content of any file and then print it on the output screen.
#include <stdlib.h> // for exit() function
if ((fptr = fopen("studytonight.txt", "r")) == NULL)
printf("Error! opening file");
// exit from program if file pointer returns NULL.
// read the text until newline
printf("Data from the file:\n%s", c);
Data from the file:
/* Data in the file will get printed. */