Don't return a value from fprintf/fputs if no fid is given (and it defaults to stdout) so that you don't have ans= interspersed with your fprintf output. Paul Kienzle pkienzle@kienzle.powernet.co.uk *** src/file-io.cc 2000/10/05 12:32:11 1.1 --- src/file-io.cc 2000/11/14 10:07:34 *************** from the beginning of the file @var{fid} *** 630,636 **** return retval; } ! DEFUN (fprintf, args, , "-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} fprintf (@var{fid}, @var{template}, @dots{})\n\ This function is just like @code{printf}, except that the output is\n\ --- 630,636 ---- return retval; } ! DEFUN (fprintf, args, nargout, "-*- texinfo -*-\n\ @deftypefn {Built-in Function} {} fprintf (@var{fid}, @var{template}, @dots{})\n\ This function is just like @code{printf}, except that the output is\n\ *************** written to the stream @var{fid} instead *** 638,643 **** --- 638,644 ---- @end deftypefn") { double retval = -1.0; + bool do_return = true; int nargin = args.length (); *************** written to the stream @var{fid} instead *** 646,653 **** octave_stream os; int fmt_n = 0; ! if (args(0).is_string ()) ! os = octave_stream_list::lookup (1, "fprintf"); else { fmt_n = 1; --- 647,657 ---- octave_stream os; int fmt_n = 0; ! if (args(0).is_string ()) ! { ! os = octave_stream_list::lookup (1, "fprintf"); ! do_return = (nargout != 0); ! } else { fmt_n = 1; *************** written to the stream @var{fid} instead *** 679,685 **** else print_usage ("fprintf"); ! return retval; } DEFUN (fputs, args, , --- 683,692 ---- else print_usage ("fprintf"); ! if (do_return) ! return retval; ! else ! return octave_value(); } DEFUN (fputs, args, ,