When working with stream oriented data file,the first step is to establish a buffer area,where information is temporarily stored while being transferred between computers memory and data file.The buffer area can be established by declaring a file pointer.
The file pointer is the common thread that unites the buffered I/O systsm. A file pinter is a pointer to information that defines various things about the file,
including its name, status, and the current position of the file. In essence, the file pointer identifies a specific disk file and is used by the associated stream to direct the operation of the buffered I/O functions. A file pointer is a pointer variable of type FILE that is defined in stdio.h.file pointer variable can be declared as :
FILE *fp;
Where FILE is a special structure that establishes the buffer area, fp is a pointer variable that indicates the beginning of the buffer area.
The file stream structure FILE defined in DOS is shown below. It is not a good practice to use the members of the FILE structure.
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*/
Silan Software is one of the India's leading provider of offline & online training for Java, Python, AI (Machine Learning, Deep Learning), Data Science, Software Development & many more emerging Technologies.
We provide Academic Training || Industrial Training || Corporate Training || Internship || Java || Python || AI using Python || Data Science etc