C file structure & file pointer



FILE structure in C Programming

  1. C Provides smart way to manipulate data using streams
  2. In stdio.h header file FILE structure is defined
  3. FILE structure provides us the necessary information about a FILE or stream which performs input and output operations

Structure :

typedef struct 
{
 short level ;
 short token ;
 short bsize ;
 char fd ;
 unsigned flags ;
 unsigned char hold ;
 unsigned char *buffer ;
 unsigned char * curp ;
 unsigned istemp; 
}FILE ;

Members of Structure :

Member
Use / Function
level
Fill / Empty level of Buffer
token
Validity Checking
bsize
Buffer size
fd
File descriptor using which file can be identified
flags
File status flag
hold
ungetc character if no buffer space available
buffer
Data transfer buffer
curp
Current active pointer
istemp
Temp. File indicator