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;
}