C program to read data from file.

Posted by Mangesh on March 31, 2018

/* C program to read data from file. */

Description :

We want to read data from file using C language and display it on the screen.

Program :

void main()
  char data[1000];
  FILE *file;
  file = fopen("data.txt","r");
  if(file == NULL){
    printf("File is empty!!!");
    printf("data : %s",data);

Output :

c program for read file Executed and Tested in Turbo C 3.2

Written with from Mangesh.

Related Post
1 C program to read data from file.
2 C program to write data into file.
3 C program to delete the File.
Latest Post
1 C program to implement Queue using linked list.
2 C program for binary search tree (BST).
3 C program to search an element in linked list.
4 C program for postorder traversal in binary tree.
5 C program for preorder traversal in binary tree.