changeset 12996:7aafa7a2edad

sscanf: correctly set output position when reading stops at end of string * file-io.cc (Fsscanf): Set POS output to string length if reading stops at end of string.
author John W. Eaton <jwe@octave.org>
date Wed, 24 Aug 2011 12:19:00 -0400
parents 7872afb42fab
children c91bd3f10bec
files src/file-io.cc
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/file-io.cc
+++ b/src/file-io.cc
@@ -1247,7 +1247,8 @@
                           // position will clear it.
                           std::string errmsg = os.error ();
 
-                          retval(3) = os.tell () + 1;
+                          retval(3)
+                            = (os.eof () ? data.length () : os.tell ()) + 1;
                           retval(2) = errmsg;
                           retval(1) = count;
                           retval(0) = tmp;