C Program to print contents of file
fopen() is used to open and fclose() is used to close a file in C
Take a step-up from those "Hello World" programs. Learn to implement data structures like Heap, Stacks, Linked List and many more! Check out our Data Structures in C
course to start learning today.
#include <stdlib.h> // For exit()
"Enter the filename to open \n"
(fptr == NULL)
"Cannot open file \n"
(c != EOF)
Enter the filename to open
/*Contents of a.txt*/