# HG changeset patch # User jwe # Date 831969786 0 # Node ID ee08cc210438d7bfe711f23b62b36098b3caa6fd # Parent 678cb6a93368c151ef822fa6f1f0ae5708161f2b [project @ 1996-05-13 06:42:10 by jwe] diff -r 678cb6a93368 -r ee08cc210438 src/file-io.cc --- a/src/file-io.cc Mon May 13 06:15:09 1996 +0000 +++ b/src/file-io.cc Mon May 13 06:43:06 1996 +0000 @@ -541,7 +541,7 @@ octave_ostrstream ostr; - octave_stream os (&ostr); + octave_stream os (&ostr, true); if (os) { @@ -673,7 +673,7 @@ octave_istrstream istr (data); - octave_stream os (&istr); + octave_stream os (&istr, true); if (os) { diff -r 678cb6a93368 -r ee08cc210438 src/oct-stream.h --- a/src/oct-stream.h Mon May 13 06:15:09 1996 +0000 +++ b/src/oct-stream.h Mon May 13 06:43:06 1996 +0000 @@ -362,9 +362,14 @@ { public: - octave_stream (octave_base_stream *bs = 0) : rep (bs) { } + octave_stream (octave_base_stream *bs = 0, bool pf = false) + : rep (bs), preserve (pf) { } - ~octave_stream (void) { delete rep; } + ~octave_stream (void) + { + if (! preserve) + delete rep; + } int flush (void); @@ -429,6 +434,9 @@ // The actual representation of this stream. octave_base_stream *rep; + // If true, don't delete rep. + bool preserve; + void invalid_stream_error (const char *op) const; bool stream_ok (const char *op, bool clear = true) const