MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

Q: How to avoid WriteBinary to write an extra nul after each call ?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg25313] Q: How to avoid WriteBinary to write an extra nul after each call ?
  • From: Claudius Schnörr <schnoerr at mailzone.com>
  • Date: Tue, 19 Sep 2000 03:45:43 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Hello,

I would like to write some peaces of data in a file. 
Now I wonder that WriteBinary appends an nul-character after each
call.
How can I avoid this behaviour?

Any suggestions are welcome!

Please answer directly to schnoerr at mailzone.com

Thank you very much in advance,

Claudius


Example:
--------------
Needs["Utilities`BinaryFiles`"];
data1 = "AAAAA";
data2 = "BBBBB";

stream = OpenWriteBinary[ "test.dat"];
WriteBinary[stream, data1];
WriteBinary[stream, data2];
Close[stream];

This results in an 12 Byte file instead of 10 Bytes due to an extra
character after data1 and data2.
(An EOF-character at the end of the file I could live with.)

od -a test.dat:
0000000   A   A   A   A   A nul   B   B   B   B   B nul
0000014

I'm working with Mathematica 4.0.1.0 on WindowsNT on a PC.
-- 
----------------------------------------------------------------
Dr.-Ing. Claudius Schn"orr        Tel: ++49-(0)211-5591570
Sigmaringenstr. 2
40547 D"usseldorf / Germany       e-mail: schnoerr at mailzone.com
----------------------------------------------------------------


  • Prev by Date: RE: Newbie question
  • Next by Date: Re: Animate multiple listplots
  • Previous by thread: Re: Noise Sphere
  • Next by thread: Re: Q: How to avoid WriteBinary to write an extra nul after each call ?