//
// Written by Curtis Olson, started November 1999.
//
-// Copyright (C) 1999 Curtis L. Olson - curt@flightgear.org
+// Copyright (C) 1999 Curtis L. Olson - http://www.flightgear.org/~curt
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
SGFile::SGFile( const string &file) {
set_type( sgFileType );
file_name = file;
+ eof_flag = true;
}
return false;
}
+ eof_flag = false;
return true;
}
// read a block of data of specified size
int SGFile::read( char *buf, int length ) {
// read a chunk
- return ::read( fp, buf, length );
+ ssize_t result = ::read( fp, buf, length );
+ if ( length > 0 && result == 0 ) {
+ eof_flag = true;
+ }
+ return result;
}
int pos = lseek( fp, 0, SEEK_CUR );
// read a chunk
- int result = ::read( fp, buf, length );
+ ssize_t result = ::read( fp, buf, length );
+ if ( length > 0 && result == 0 ) {
+ eof_flag = true;
+ }
// find the end of line and reset position
int i;
return false;
}
+ eof_flag = true;
return true;
}