Mercurial > hg > octave-terminal
changeset 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 | fa4dfbc33ce5 |
files | src/ChangeLog src/oct-stream.cc src/variables.cc |
diffstat | 3 files changed, 18 insertions(+), 16 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,11 @@ 2002-12-17 John W. Eaton <jwe@bevo.che.wisc.edu> + * variables.cc (Fclear): Fix off-by-one error. + + * oct-stream.cc (octave_base_stream::do_gets): Correctly read + last line of file even if it does not end with new line + character. + * pt-select.cc (equal): Don't look up == op, just try it and see whether it works.
--- 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 {