Search



Friday, 21 August 2015

Files Theory

In C, each file is simply a sequential stream of bytes. Our programs are stored in files.
Text Files – are also called stream oriented data files. In these files the data is written as stream of characters & it is read as stream of characters.

Operations:

  • Writing in a file 
  • Reading from a file
 There are four steps to execute write/read operations.
  • Establishing a buffer area
  • Open file
  • Write into file / Read from file 
  • Close file

File handling in C

  • In C we use FILE * to represent a pointer to a file.
  • fopen is used to open a file.  It returns the special value NULL to indicate that it couldn't open the file.
     FILE *P;
Modes for opening files : click here

No comments:

Post a Comment

Guys if you think something is wrong or should be edit than please do comment.