Check the best File I/O tutorial, at:
http://www.cpp-home.com/FileIO_tutorial.php