Mercurial > hg > octave-nkf
changeset 6759:dd8cef76043d
[project @ 2007-06-26 15:54:40 by jwe]
author | jwe |
---|---|
date | Tue, 26 Jun 2007 15:54:41 +0000 |
parents | 1894012e6b84 |
children | 301885c9d265 |
files | src/ChangeLog src/load-save.cc |
diffstat | 2 files changed, 19 insertions(+), 8 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2007-06-26 John W. Eaton <jwe@octave.org> + + * src/load-save.cc (Fsave): Open files correctly for -append. + Don't write file headers if appending. Error for -append -hdf5. + 2007-06-25 Olaf Till <i7tiol@t-online.de> * oct-stream.h (octave_stream_list::list): Use std::map.
--- a/src/load-save.cc +++ b/src/load-save.cc @@ -1648,6 +1648,9 @@ // don't insert any commands here! the brace below must go // with the "else" above! { + if (append) + warning ("save: ignoring -append option for output to stdout"); + // FIXME -- should things intended for the screen end up // in a octave_value (string)? @@ -1669,12 +1672,13 @@ i++; - std::ios::openmode mode = std::ios::out; - // Matlab v7 files are always compressed if (format == LS_MAT7_BINARY) use_zlib = false; + std::ios::openmode mode + = append ? (std::ios::app | std::ios::ate) : std::ios::out; + if (format == LS_BINARY #ifdef HAVE_HDF5 || format == LS_HDF5 @@ -1684,11 +1688,17 @@ || format == LS_MAT7_BINARY) mode |= std::ios::binary; - mode |= append ? std::ios::ate : std::ios::trunc; - + bool write_header_info = ! append; + #ifdef HAVE_HDF5 if (format == LS_HDF5) { + if (append) + { + error ("save: appending to HDF5 files is not implemented"); + return retval; + } + hdf5_ofstream hdf5_file (fname.c_str ()); if (hdf5_file.file_id >= 0) @@ -1716,8 +1726,6 @@ if (file) { - bool write_header_info = ! file.tellp (); - save_vars (argv, i, argc, file, format, save_as_floats, write_header_info); @@ -1736,8 +1744,6 @@ if (file) { - bool write_header_info = ! file.tellp (); - save_vars (argv, i, argc, file, format, save_as_floats, write_header_info);