Mercurial > hg > octave-nkf
diff src/oct-stream.cc @ 4224:0179e6309248
[project @ 2002-12-18 00:34:29 by jwe]
author | jwe |
---|---|
date | Wed, 18 Dec 2002 00:34:29 +0000 |
parents | 5ebaf7eee36e |
children | ccfdb55c8156 |
line wrap: on
line diff
--- a/src/oct-stream.cc +++ b/src/oct-stream.cc @@ -974,26 +974,22 @@ break; } - if (is.fail ()) - { - err = true; - std::string msg = fcn; - msg.append (": read error"); - error (msg); - } - else if (char_count == 0 && is.eof ()) - { - err = true; - std::string msg = fcn; - msg.append (": at end of file"); - error (msg); - } - else + if (is.good () || (is.eof () && char_count > 0)) { buf << OSSTREAM_ENDS; retval = OSSTREAM_STR (buf); OSSTREAM_FREEZE (buf); } + else + { + err = true; + std::string msg = fcn; + if (is.eof () && char_count == 0) + msg.append (": at end of file"); + else + msg.append (": read error"); + error (msg); + } } else {