Does anyone out there know anything about random file access.
Printable View
Does anyone out there know anything about random file access.
Yes. What do you want to know about it? It is more complicated that normal read, write or append methods. You have to keep track of your position in the file. If you do an insert, then you have to move every character after the insert, and vice versa for a delete.
My teacher just had me start them, and I wasn't really sure where to start.
your teacher sounds like a dweeb!!! who is a MAC lover!!!!!
He does love a good MAC.
All of this aside, can anyone tell me a good place to start into random file access.
>All of this aside, can anyone tell me a good place to start into random file access.
Start off with a file opened in binary mode. Make sure that every record is the same size, padded if the data doesn't fill the record, then you can calculate an offset for the file, go directly to it, and read the correct record:
file.seekg ( RECORD_SIZE * offset );
-Prelude