I do this
The result is "FRACK!" the second time I run this code (it is done in a while loop)Code:ifstream codefin; ofstream codefout; while (not_annoyed) { codefout.open("bar"); // write to bar, works fine codefout.bar(); system("command to change bar to foo"); codefin.open("foo"); if (!codefin.is_open()) cout<<"ERROR: couldn't open foo for reading"<<endl; if (codefin.eof()) cout<<"FRACK!\n"; while (!codefin.eof()) getline(codefin,text); codefin.close(); }
Why? Shouldn't the file be opened in the beginning? The file "foo" is changed before each run, but that shouldn't matter, should it?