Updating a file using random access
Before opening a file for random access, define a type that corresponds to the records the file does or will contain.
For example, an Employee Records file could declare a user-defined data type called have a fixed length of 15 characters.
Using file streams, we can randomly access binary files.
By random access, you can go to any position in the file as you wish (instead of going in a sequential order from the first character to the last).
The only way to get to a point on the tape was by reading all the way through the tape.For ifstream the pointer is called as get pointer and for ofstream the pointer is called as put pointer.fstream can perform both input and output operations and hence it has one get pointer and one put pointer.This is what I have tried so far to accomplish the above.No matter what I try, I just can't write a single updated record back to the file.