Mercurial > hg > octave-shane
changeset 5370:f07a9653b844
[project @ 2005-05-24 02:25:57 by jwe]
author | jwe |
---|---|
date | Tue, 24 May 2005 02:25:58 +0000 |
parents | 4bbde94b5cf8 |
children | 30b2b6ef8597 |
files | src/ChangeLog src/file-io.cc src/oct-stdstrm.h |
diffstat | 3 files changed, 19 insertions(+), 18 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,5 +1,11 @@ 2005-05-23 John W. Eaton <jwe@octave.org> + * file-io.cc (Ffopen): Don't fail with internal error message if + we fail to create a valid stream object. + (do_stream_open (const std::string&, const std::string&, + const std::string&, int&): Always create octave_stream object, + even if file pointer returne from fopen is 0. + * load-save.cc (gripe_file_open): New function. (get_file_format, Fload, Fsave): Use it.
--- a/src/file-io.cc +++ b/src/file-io.cc @@ -414,9 +414,9 @@ { FILE *fptr = ::fopen (name.c_str (), mode.c_str ()); - if (fptr) - retval = octave_stdiostream::create (name, fptr, md, flt_fmt); - else + retval = octave_stdiostream::create (name, fptr, md, flt_fmt); + + if (! fptr) { using namespace std; retval.error (::strerror (errno)); @@ -608,23 +608,18 @@ octave_stream os = do_stream_open (args(0), mode, arch, "fopen", fid); - if (os.is_valid ()) + if (os && ! error_state) { - if (os && ! error_state) - { - retval(1) = ""; - retval(0) = octave_stream_list::insert (os); - } - else - { - int error_number = 0; - - retval(1) = os.error (false, error_number); - retval(0) = -1.0; - } + retval(1) = ""; + retval(0) = octave_stream_list::insert (os); } else - error ("fopen: internal error"); + { + int error_number = 0; + + retval(1) = os.error (false, error_number); + retval(0) = -1.0; + } } else print_usage ("fopen");