Skip to main content

Posts

Showing posts with the label Examples of opening and closing file

Opening and Closing a File in C programming

        While working with stream-oriented file, we need buffer area where information is stored temporarily in the course of transferring data between computer memory and data file. The buffer area is established as              FILE * ptr_varibale;           Where FILE is a special structure type that establishes the buffer area and ptr_variable is a pointer variable that indicates the beginning address of the buffer area. The special structure FILE is defined within header file stdio.h. A data file must be opened before it can be created or processed. This is done by following syntax          ptr_variable=fopen(file_name, file_mode); This associate file name with the buffer area and specifies how the data file will be utilized (File opening mode). The function fopen() returns a pointer to th...