The processing of a file involves the following steps:
- opening a file
- reading or writing a file
- closing a file
Opening a file: Opening a file establish a link between the program and the operating system.
Where file is the data structure included in stdio.h and fp is file pointer which points to the start of the file.
opening a file
Where fp is pointer to structure of type FILE.
closing a file, fclose(fp);
Program to enter data of mixed types in a file
printf(“\n Cannot open file”);
printf(“enter name,age and salary “);
printf(“\n More records(y/n)?”);
enter name, age and salary: devilson 23 444444
more record (y/n)?