C++ file I/O
Hi guys,
I have created methods for saving and loading my objects to and from disk. They work fine. I'm using VC++ .Net 2003, but I'm using std ifstream & ofstream.
I'm wondering what kinds of exceptions can this throw?
I'm especially interested in how I would find if the file intended to be loaded does not exist? How would I deal with this error.
Thanks for any help given!
Hey bud,
What i would do here is simply try and open the file as you prolly already are, but then immediately check the whether it is open or not, like this:
I'm not particularly expereince with C++ files but i believe there is no need to worry about exceptions here. If it isn't open then it isn't open.
Hope that helps,
Dave
What i would do here is simply try and open the file as you prolly already are, but then immediately check the whether it is open or not, like this:
if ( myFile.is_open() ){ // blah}
I'm not particularly expereince with C++ files but i believe there is no need to worry about exceptions here. If it isn't open then it isn't open.
Hope that helps,
Dave
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement