Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1996
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1996

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

Search the Archive

Re: Binary files under MS Windows

  • To: mathgroup at smc.vnet.net
  • Subject: [mg4210] Re: Binary files under MS Windows
  • From: ianc (Ian Collier)
  • Date: Tue, 18 Jun 1996 03:24:55 -0400
  • Organization: Wolfram Research, Inc.
  • Sender: owner-wri-mathgroup at wolfram.com

In article <4pisag$iuo at dragonfly.wolfram.com>, John Bunda
<bunda at centtech.com> wrote:

> Ok, so I've already found out that Mathlink can't handle
> IEEE 80-bit floats on Intel (due to a bug that Wolfram 
> won't fix).
> 
> So I hacked up a crude way of transferring data using
> the BinaryFile package in Utilities.   Unfortunately,
> on DOS/Windows, this isn't a real binary file interface,
> because the OpenFile[] builtin function that gets called 
> doesn't actually open the file as binary.  
> So, if the binary data in the file contains a byte that 
> just happens to equal the DOS eof character (hex 1a, 
> decimal 26 - please, please, don't get me started on Microsoft 
> toy OSes), the read returns EOF instead of the number.
> 
> Does anyone know of a workaround that will allow me to
> actually read binary files on the Windows platform?
> Thanks in advance.  By the way, if I can get this to
> work, I will post my enhanced version of the binary
> files package that supports little-endian/long doubles.
> 
> -John


Take a look at Todd Gayley's FastBinaryFiles package. It is a 
MathLink package that is much faster than Utilities`BinaryFile`
and also works correctly under Windows. I believe thit it 
will do all that you need.

It is available on MathSource, Wolfram Research's electronic
library of Mathematica materials. Here is the MathSource 
description:


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).

-----------------------------------------------------------
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] ====


  • Prev by Date: Re: help! to input data...
  • Next by Date: psfix on Mac???
  • Previous by thread: Binary files under MS Windows
  • Next by thread: Re: Binary files under MS Windows