/    /  File Structure

File Structure

 

I/O functions available are similar to console functions; scanf becomes fscanf, printf becomes fprintf, etc. These functions are read and written from file streams. For example, the file flow structure FILE defined in the header file stdio.h in DOS is shown below:

 

typedef struct
{
int level; //fill/empty level of buffer
unsigned flags; //File status flags
char fd; //File descriptor (handle)
unsigned char hold; //Ungetc char if no buffer
int bsize; //Buffer size
unsigned char _FAR *buffer; //Data transfer buffer
unsigned char _FAR *curp; //Current active pointer
unsigned istemp;  //Temporary file indicator
short token;//Used for validity checking
} FILE;  //This is the FILE Object

 

NOTE: FILE is defined as New Structure Data Type in the stdio.h file as shown in the above method.