Avoid comparing filepos with integers
The filepos type is not necessarily an integer type, because it also needs to save the multibyte character state in case we're reading from a stream with shift states. The convention of using -1 as a special value is from Unix ftell(), and not portable. Instead, the stream's failbit needs to be examined after the call to tellg().
This commit is contained in:
parent
05ee63fe39
commit
ba66f0360a
|
@ -37,7 +37,7 @@ bool IDF3::FetchIDFLine( std::ifstream& aModel, std::string& aLine, bool& isComm
|
|||
aLine = "";
|
||||
aFilePos = aModel.tellg();
|
||||
|
||||
if( aFilePos == -1 )
|
||||
if( aModel.fail() )
|
||||
return false;
|
||||
|
||||
std::getline( aModel, aLine );
|
||||
|
|
Loading…
Reference in New Issue