C++: .eof on an empty file
问题 Lets see this program: ifstream filein("hey.txt"); if(filein.eof()){ cout<<"END"<<endl; } Here "hey.txt" is empty. So the if condition here is thought should have been true But it isnt Why isnt the eof returning true although the file is empty? If i added this before the if the eof returns true although arr is still empty and the file is still empty so both unchanged char arr[100]; filein.getline(arr,99); 回答1: eof() function returns "true" after the program attempts to read past the end of