So in the constructor for my class, i want it to check to see if the list file is there list.bin if so i want it to open it, else wise, i'd like it to create it. I also want it to ignore it if it's empty, but it doesn't seems to work.
Code:std::ifstream fin("list.bin", ios::binary); //open it to read? Can this also create it? if (!fin){ // if it doesn't exist? this works. wxMessageBox("File Function Failed!"); } else { // if it exists... if(!fin.eof()){ // .. but what if it's empty? wxMessageBox("NOT EMPTY!"); // this happens with a seemingly empty file! } else { wxMessageBox(" EMPTY!"); fin.close(); // this is in the wrong place, ignore it! } }