changeset 12997:bac0858b92ee stable

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 b12e2cffaa2f
children c91bd3f10bec 12df4a154618
files src/file-io.cc
diffstat 1 files changed, 2 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/file-io.cc	Wed Aug 24 11:32:18 2011 -0400
+++ b/src/file-io.cc	Wed Aug 24 12:19:00 2011 -0400
@@ -1249,7 +1249,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;