*/
virtual bool close();
+ /**
+ * The eof() method returns true if end of file has been reached
+ * in a context where that makes sense. Otherwise it returns
+ * false.
+ * @return result of eof check
+ */
+ virtual bool eof();
+
inline void set_type( SGChannelType t ) { type = t; }
inline SGChannelType get_type() const { return type; }
int SGFile::read( char *buf, int length ) {
// read a chunk
ssize_t result = ::read( fp, buf, length );
- if ( result == 0 ) {
+ if ( length > 0 && result == 0 ) {
eof_flag = true;
}
return result;
// read a chunk
ssize_t result = ::read( fp, buf, length );
- if ( result == 0 ) {
+ if ( length > 0 && result == 0 ) {
eof_flag = true;
}