Operations on the File
There are various operations which can be implemented on a file. We will see all of them in detail.
Creation of the file is the most important operation on the file. Different types of files are created by different methods for example text editors are used to create a text file, word processors are used to create a word file and Image editors are used to create the image files.
Writing the file is different from creating the file. The OS maintains a write pointer for every file which points to the position in the file from which, the data needs to be written.
Every file is opened in three different modes : Read, Write and append. A Read pointer is maintained by the OS, pointing to the position up to which, the data has been read.
Re-positioning is simply moving the file pointers forward or backward depending upon the user's requirement. It is also called as seeking.
Deleting the file will not only delete all the data stored inside the file, It also deletes all the attributes of the file. The space which is allocated to the file will now become available and can be allocated to the other files.
Truncating is simply deleting the file except deleting attributes. The file is not completely deleted although the information stored inside the file get replaced.