
-----------------------------------
copthesaint
Mon Feb 11, 2013 2:27 pm

Help understanding this File I/O Example
-----------------------------------
I was reading an example online for File I/O, here is the link for the [url=http://www.developer.nokia.com/Community/Wiki/Reading_and_writing_binary_files_in_Open_C%2B%2B]Source.

I have a few questions that I hope can be better explained. 

1: Is the friend function in this example ever used? I can't see that there is any direct use of it in this function. Is it purely exemplary?

2: When fstream writes the binary information for the class, what is written? I would have to guess when the class is written, so is the information for the size of the objects in the class, 4 bytes for the int, 1 byte for the char but what is the other 3 bytes for? (assuming what is written is derived from the size of the class.)

Thanks if you help provide any clarity.

-----------------------------------
DemonWasp
Mon Feb 11, 2013 7:18 pm

RE:Help understanding this File I/O Example
-----------------------------------
The friend qualifier on a function just says "this function can access private members", even though technically that function, operator