Reading a Record
This is done in MyFile::Read(int index). It looks up the indextype withindexvector[index]
This lets you treat a vector just like an array and returns an indextype struct. Because the fstream reads data into chars, the class member buffer is used as a temporary buffer. It is resized with each read which is not very efficient. If you know the maximum size of data that will be read it could be created big enough just once. After reading the record into memory, a null character \0 is appended to turn it into a proper c-string. Don't forget it or you'll get a string with lots of rubbish on the end.
To test that it works correctly, the data file is opened for reading and a record read in. As the 1000 strings were written with a string length = 5 + n where n run from 0 to 1000. Record x should have a length = x + 5.
This completes this C++ programming tutorial on random access files. The next one will be on text files.

