changeset 3337:9c782a34b545

[project @ 1999-11-04 01:51:34 by jwe]
author jwe
date Thu, 04 Nov 1999 01:51:34 +0000
parents 08ad797989f8
children bb5023dbee3d
files src/ChangeLog src/oct-stream.cc
diffstat 2 files changed, 21 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Wed Nov 03 21:41:35 1999 +0000
+++ b/src/ChangeLog	Thu Nov 04 01:51:34 1999 +0000
@@ -1,3 +1,10 @@
+1999-11-03  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* oct-stream.cc (octave_base_stream::do_scanf): If it looks like
+	we have a matching failure, then reset the failbit in the stream
+	state.
+	(octave_base_stream::do_oscanf): Likewise.
+
 1999-11-02  Ben Sapp <bsapp@nua.lampf.lanl.gov>
 
 	* src/help.cc (Fhelp): Texinfoize doc string.
--- a/src/oct-stream.cc	Wed Nov 03 21:41:35 1999 +0000
+++ b/src/oct-stream.cc	Thu Nov 04 01:51:34 1999 +0000
@@ -1264,6 +1264,12 @@
 		      final_nc = 1;
 		    }
 
+		  // If it looks like we have a matching failure, then
+		  // reset the failbit in the stream state.
+
+		  if (is.rdstate () & ios::failbit)
+		    is.clear (is.rdstate () & (~ios::failbit));
+
 		  // XXX FIXME XXX -- is this the right thing to do?
 		  // What about other streams?
 		  if (name () == "stdin")
@@ -1336,10 +1342,16 @@
 
 		if (! is)
 		  {
-		    error ("fscanf: read error");
+		    // If it looks like we have a matching failure, then
+		    // reset the failbit in the stream state.
+
+		    if (is.rdstate () & ios::failbit)
+		      is.clear (is.rdstate () & (~ios::failbit));
+		    else
+		      error ("fscanf: read error");
 
 		    // XXX FIXME XXX -- is this the right thing to do?
-
+		    // What about other streams?
 		    if (name () == "stdin")
 		      {
 			is.clear ();