Sunday, September 13, 2015

Program to read file in a program

File reading:
It requires understanding of two functions fopen and fgetc

This function takes two parameters first one is file path and second one is file opening mode. there are six file modes in C language, those are r,w,a,r+,w+ and a+. Here we are using r for reading file.
fopen() returns a FILE pointer.

This function reads and returns one character at a time and moves pointer to the next character.


Post a Comment

Powered by Blogger.