When you studied cin and cout very well, you will find that file
operation is so easy. just change cin or cout to your ifstream , ofstream
or fstream object.
Only read ifsteam; Only write ofsteam; write and read fstream.
For ios_base::binary mode, use write() and read() funciton.
For writing, pay attention to the difference between ios_base::trunc and
ios_base::app
Random access is used mostly on binary file. Because the position can be
pinpointed exactly. For seekg() for input, and seekp() for output.(p is put, g
is get) It move the pointer. tellp() and tellg() function. It tell the position of
pointer.