- Files are basically used to store and write the data.
- Files are used to permanently store the data in a non volatile memory(pen drive ,hardisk).
- We were taking the input from the console and writhing it back to the console.It is not enough,if we want to display more data then it is not display on the console because data are temporely stored in RAM (volatile memory).when we off or shut down the computer/pc ,data will be lost.So that here file input/output concepts are more important.
- The file handling plays an important role when the data needs to be stored permanently into the file.
- When we use files,we can access the stored information after the program termination because files are non volatile storage.
- When we want to read ,write and modify the file ,we need to open it first.
- After performing the read ,write and modification in the file,we have to close the file.
Hence a file operation can be done in the following order.
- Open a file.
- Read or write(operations)
- Close the file.