changeset 5254:2fa6253e36a3

[project @ 2005-03-28 23:37:22 by jwe]
author jwe
date Mon, 28 Mar 2005 23:37:22 +0000
parents 6b91c98e3db0
children 3c4237738c3e
files src/ChangeLog src/oct-stream.cc
diffstat 2 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/ChangeLog	Mon Mar 28 18:56:56 2005 +0000
+++ b/src/ChangeLog	Mon Mar 28 23:37:22 2005 +0000
@@ -1,5 +1,8 @@
 2005-03-28  John W. Eaton  <jwe@octave.org>
 
+	* oct-stream.cc (octave_stream::write): For compatibility, Write
+	zeros instead of seeking if SKIP is nonzero.
+
 	* DLD-FUNCTIONS/gplot.l (Fgraw): Recommend __gnuplot_raw__, not
 	__gnuplot__raw__.
 	(Fgshow): Recommend __gnuplot_show__, not __gnuplot__show__.
--- a/src/oct-stream.cc	Mon Mar 28 18:56:56 2005 +0000
+++ b/src/oct-stream.cc	Mon Mar 28 23:37:22 2005 +0000
@@ -3471,8 +3471,18 @@
 	{
 	  std::ostream& os = *osp;
 
+	  // It seems that Matlab writes zeros instead of actually
+	  // seeking.  Hmm...
+
 	  if (skip != 0 && (i % block_size) == 0)
-	    seek (skip, SEEK_CUR);
+	    {
+	      // XXX FIXME XXX -- probably should try to write larger
+	      // blocks...
+
+	      unsigned char zero = 0;
+	      for (int j = 0; j < skip; j++)
+		os.write (reinterpret_cast<const char *> (&zero), 1);
+	    }
 
 	  if (os)
 	    {