I have discussed the concept of "files" in my previous blog.Today I am discussing the different file access method.
File access Method
The way in which a file can be accessed is called file access method.It depends on the manner in which data is stored in the files.Different file access methods are given below:
Sequential Access Method:
It is used to access data in the same manner in which it is stored in a file.This method reads and writes data in a sequence.In order to access the last record,it has to to read all the records before the last one.
The record is not fixed in this access method.It means that each record occupies different amount of memory.
One of its advantages is that memory is not wasted.One of its disadvantages is that it takes very long time to search a record.For example,if the user wants to search the 4th record,it has to read the first 3 records to access the 4th record.
Random Access Method:
It is used to access the data directly without accessing the preceding data.This method does not read or write data in a sequence.It is faster than sequential access method.
It stores data in fixed length records.This is the main disadvantage of this access method.It wastes memory space.Suppose a record of 10 bytes is used to store a complete sentence in a file.If a sentence consists of a single letter like 'H', it will occupy 10 bytes to store this letter.
However,this method speeds up access time because the position of each record can be determined easily as each record takes fixed length.Database management systems store files in a random access format.
This comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteC++
ReplyDelete