MathGroup Archive 1996

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

Search the Archive

Re: binary file i/o

  • To: mathgroup at smc.vnet.net
  • Subject: [mg4631] Re: binary file i/o
  • From: Harald Berndt <haraldb at nature.berkeley.edu>
  • Date: Thu, 22 Aug 1996 03:54:50 -0400
  • Organization: University of California Forest Products Lab
  • Sender: owner-wri-mathgroup at wolfram.com

William Weglinski wrote:
> 
> I am having difficulty reading and writing binary files correctly, With Mathematica 2.2
> for Windows on my PC.  The first problem is that if a file contains the byte: 1A (i.e.
> hexadecimal 26), it is interpreted as EndOfFile, and I can't figure out any way to force
> Mathematica to read any more bytes after that.  The second problem is trying to write
> the byte 0A (i.e. hexadecimal 10 -- a.k.a. linefeed ) to a file.  Instead of writing
> just the byte: 0A, the bytes: 0D0A are outputted (carriage return+linefeed).  Again, I
> can't find any way to override this behavior.  The standard Mathematica package:
> Utilities`BinaryFiles` was of no help to me, nor could I make it work using the
> WriteString[] command directly. Setting the StringConversion option on the outputstream
> didn't work either.  Has anyone else encountered this problem, and what can be done to
> work around it?

In order to work with binary files on DOS systems, you'll need to use 
MathLink and Todd Gayley's package FastBinaryFiles.m (from 
MathSource). It's the only way right now. I believe that Mma fo Win 
2.2.3 finally supported MathLink. (Personally, I switched to the Mac 
for just that reason: to read DOS binary files into Mma).

-- 
_______________________________________________________________
Harald Berndt                          University of California
Research Specialist                  Forest Products Laboratory
Phone: 510-215-4224                            FAX:510-215-4299
_______________________________________________________________



==== [MESSAGE SEPARATOR] ====


  • Prev by Date: Re: How to think about Map[ ] ?
  • Next by Date: Re: fitting differential eq. to data
  • Previous by thread: binary file i/o
  • Next by thread: Mma: 13 is not prime!