I suggest that you catch the exceptions while writing and reading (it is a must in java now days 🙂 ) and take a look about CFile at msdn -> it is a MFC class
have fun 🙂