Re: Problem reading binary files - news26.txt [1/1]
- To: mathgroup at smc.vnet.net
- Subject: [mg3339] Re: Problem reading binary files - news26.txt [1/1]
- From: ianc (Ian Collier)
- Date: Wed, 28 Feb 1996 03:36:15 -0500
- Organization: Wolfram Research, Inc.
- Sender: owner-wri-mathgroup at wolfram.com
In article <4gp4o5$m1c at dragonfly.wolfram.com>, peter at physto.se (Peter Weijnnitz) wrote: > I am using Mathematica 2.2.1 for windows 3.1 and I have found a problem > when reading binary files, e.g. ReadList["bin.raw",{<<listofByte>>}] > where bin.raw is a file of size Length[listofByte]. > > It seems that the problem occures when ReadList finds a binary sequence > coerresponding to decimal 26 (ascii=^z SUB) this sequence Mathematica interprets as a > EndOfFile and the rest of the file is not read in (the rest of listofByte is filled with > EndOfFile ). What is the cure for this? > > I have tried: > 1 Mathematica ver. 2.2.3 > 2 reading characters instead > 3 using the package BinaryFiles > > with the same result > > Peter W You will need to use Todd Gayley's FastBinaryFiles program that is available on MathSource, Wolfram Research's electronic library of Mathematica materials. Here are the details: 0206-783: FastBinaryFiles: A MathLink Program for Fast Reading and Writing of Binary Files Todd Gayley FastBinaryFiles is a MathLink program and Mathematica package for fast reading and writing of binary files. It is intended as a replacement for the standard package Utilities`BinaryFiles`, which is slow and cannot be used under MS Windows. A ready-to- run executable is available for Mac and Windows; others will have to build the program from the single source file, binary.tm. Note that there is no separate package (.m) file. If you want to use the program on Mac or Windows, the executable is all you need. If you want to compile it on your own, the C source file binary.tm is all you need. You need Mathematica version 2.2 or later to use FastBinaryFiles (I haven't tried it with v2.1, but it might work). DOS users cannot use it, as MathLink is not available for DOS, and Windows users need either version 2.2.2, or 2.2.1 and the MathLink Developer's Kit for Windows. This program is discussed more fully in Volume 4, Issue 2 of The Mathematica Journal. MathSource is accessible by email (mathsource at wolfram.com), by anonymous ftp/gopher (mathsource.wolfram.com) and by World Wide Web (http://www.wolfram.com/MathSource.html). I hope this helps. --Ian ----------------------------------------------------------- Ian Collier Wolfram Research, Inc. ----------------------------------------------------------- tel:(217) 398-0700 fax:(217) 398-0747 ianc at wolfram.com Wolfram Research Home Page: http://www.wolfram.com/ ----------------------------------------------------------- ==== [MESSAGE SEPARATOR] ====