Dai un'occhiata anche a

http://www.cplusplus.com/doc/tutorial/files/

per maggiori info