changeset 4798:da0d1c453971

[project @ 2004-02-24 17:30:05 by jwe]
author jwe
date Tue, 24 Feb 2004 17:30:05 +0000
parents 19b8225bdaa2
children e2d7d1ef5e55
files src/ChangeLog src/file-io.cc
diffstat 2 files changed, 18 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Mon Feb 23 22:10:32 2004 +0000
+++ b/src/ChangeLog	Tue Feb 24 17:30:05 2004 +0000
@@ -1,3 +1,8 @@
+2004-02-24  John W. Eaton  <jwe@bevo.che.wisc.edu>
+
+	* file-io.cc (do_stream_open): Don't call ::error if stream can't
+	be created.  Don't call ::fopen if arch is invalid.	
+
 2004-02-23  John W. Eaton  <jwe@bevo.che.wisc.edu>
 
 	* file-io.cc (Fftell): Return long integer instead of streamoff_array.
--- a/src/file-io.cc	Mon Feb 23 22:10:32 2004 +0000
+++ b/src/file-io.cc	Tue Feb 24 17:30:05 2004 +0000
@@ -338,15 +338,21 @@
       oct_mach_info::float_format flt_fmt =
 	oct_mach_info::string_to_float_format (arch);
 
-      FILE *fptr = ::fopen (name.c_str (), mode.c_str ());
+      if (! error_state)
+	{
+	  FILE *fptr = ::fopen (name.c_str (), mode.c_str ());
+
+	  if (fptr)
+	    {
+	      retval = octave_stdiostream::create (name, fptr, md, flt_fmt);
 
-      if (fptr)
-	{	
-	  if (! error_state)
-	    retval = octave_stdiostream::create (name, fptr, md, flt_fmt);
+	      // XXX FIXME XXX -- it would now be possible for the
+	      // file id returned by fopen to correspond directly to
+	      // the underlying system file id (::fileno (fptr)).
+	      // Doing that would require some changes to the
+	      // octave_stream_list class.
+	    }
 	}
-      else
-	error ("fopen: failed to open file %s", name.c_str ());
     }
 
   return retval;