Re: Q: How to avoid WriteBinary to write an extra nul after each call ?
- To: mathgroup at smc.vnet.net
- Subject: [mg25333] Re: Q: How to avoid WriteBinary to write an extra nul after each call ?
- From: Albert Retey <albert.retey at visualanalysis.com>
- Date: Sat, 23 Sep 2000 03:35:56 -0400 (EDT)
- Organization: Visual Analysis
- References: <firstname.lastname@example.org>
- Sender: owner-wri-mathgroup at wolfram.com
> I would like to write some peaces of data in a file.
> Now I wonder that WriteBinary appends an nul-character after each
It does so only if you are storing strings, as the documentation says,
it stores strings as null-terminated as is common practice. This is to
mark the end of each string. It will not be done when storing numbers...
> How can I avoid this behaviour?
Don't write strings :-). You could also concatenate all your strings
within mathematica to one long string and then just store this long
string, this would only write one extra string-termination-character and
maybe also be a lot faster. (In general writing big blocks is a usually
a lot faster...).
Still the question arises why you want to store strings in a binary file
The main advantage of binary files you will see when storing large
arrays (lists that is in mathematica) of numeric data, I guess?
Also look into the online-documentation, I think the zero-terminated
strings is in there...
Prev by Date:
Re: matrix indices
Next by Date:
Re: Point inside a plygon? and PointInsidePolyhedronQ
Previous by thread:
Q: How to avoid WriteBinary to write an extra nul after each call ?
Next by thread: