The following program, what is wrong? I prefer the file to go all the way.
ifstream file("main.cpp", ios::binary | ios::ate); if (file) { //fstream::pos_type size = file.tellg(); file.seekg(100, fstream::cur); if (file.eof()) { cout << "eof is true\n"; } }
fstream reaches the end of the file, but why not repeat "eof is true".
The eof bit is set only (and, therefore, eof () returns true) if the actual read operation failed due to the end of file. A search operation (apparently) is not enough.
Source: https://habr.com/ru/post/1478954/More articles:CATextLayer is rasterized too early and blurred - core-animationHow to Access Synology NAS Drive Using API - nasSiteCatalyst: tracking user links in Webkit browsers - web-analyticsAndroid activity class for maintenance - androidhow can I find out in which OS I am included in a bash script - bashsplitting parenthesis grouped in python - pythonHow to call scala function from php? - phpError code 12019/12007 ajax request on IE8 - ajaxI18n Phonegap / gettext app? - cordovaAnt Task xmlproperty. What happens when there is more than one tag with the same name? - xmlAll Articles