# HG changeset patch # User Andreas Weber # Date 1405960030 -7200 # Node ID d5db1019ad4ad2912dd6ef9d15acbe56b0643da5 # Parent 64173c377a6b0ba02ba1b8c931971dadd99fa103 load-save.cc: Return string rather printing to octave_stdout diff -r 64173c377a6b -r d5db1019ad4a libinterp/corefcn/load-save.cc --- a/libinterp/corefcn/load-save.cc Mon Jul 21 08:41:42 2014 -0700 +++ b/libinterp/corefcn/load-save.cc Mon Jul 21 18:27:10 2014 +0200 @@ -1503,9 +1503,10 @@ @deftypefnx {Command} {} save options file\n\ @deftypefnx {Command} {} save options file @var{v1} @var{v2} @dots{}\n\ @deftypefnx {Command} {} save options file -struct @var{STRUCT} @var{f1} @var{f2} @dots{}\n\ +@deftypefnx {Command} {} {@var{s} =} save @samp{-} @var{v1} @var{v2} @dots{}\n\ Save the named variables @var{v1}, @var{v2}, @dots{}, in the file\n\ -@var{file}. The special filename @samp{-} may be used to write\n\ -output to the terminal. If no variable names are listed, Octave saves\n\ +@var{file}. The special filename @samp{-} may be used to return the\n\ +content of the variables as a string. If no variable names are listed, Octave saves\n\ all the variables in the current scope. Otherwise, full variable names or\n\ pattern syntax can be used to specify the variables to save.\n\ If the @option{-struct} modifier is used, fields @var{f1} @var{f2} @dots{}\n\ @@ -1680,11 +1681,10 @@ if (append) warning ("save: ignoring -append option for output to stdout"); - // FIXME: should things intended for the screen - // end up in an octave_value (string)? - - save_vars (argv, i, argc, octave_stdout, format, + std::ostringstream output_buf; + save_vars (argv, i, argc, output_buf, format, save_as_floats, true); + retval = octave_value (output_buf.str()); } }