MathGroup Archive 2000

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

Search the Archive

Re: Mathlink probs under Unix


Hmm, I am trying to use Experimental`BinaryImport now. It seems to work fine
on a windows box with the following:

str=OpenRead["c:\t\me03.sig", DOSTextFormat->False]
xx = Experimental`BinaryImport[str,{"Byte"}..}]
and then when I look at xx I feel that it is getting
the correct info, however, when I try something like a
ToString on the data it dies (under Solaris).

Where I seem to be having the problem is that the old
notebook for this was for Mathematica 3.0 and it used ReadListBinary
to read in sections of the binary file a byte or several bytes
at a time... that way the ToString works as it is not trying to
ToString the entire file.

My real question is this: I have created this binary file on
an intel based machine (little-endian) and I am moving the file
to a Sun workstation (big-endian) for analysis. Does Mathematica for
Solaris assume all binary files to be in big-endian??
Will the "ByteOrdering" option for Experimental`BinaryImport
cure this is this is true??

Thanks for the help.

John Fultz wrote:

> Your compiler is complaining about an overly long string.  This will
> probably fix it...
>
> In the file binary.tm, find something that looks like the following text:
>
> :Evaluate:
>   resolveExistingFilename[s_String]:=Module[{first=First[Characters[s]],drive,os,fileinfo,thefile},
>    Switch[os=$OperatingSystem,
>     "Unix", (* a whole bunch of stuff here *),
>     "MacOS", (* a whole bunch of stuff here *),
>     "Windows"|"WINDOWS"|"WindowsNT", (*a whole bunch of stuff here *),
>    _, (* a whole bunch of stuff here *)]]
>
> This is being turned into a C string by 'mprep', and apparently it's too
> long for your compiler to swallow.  We can make it simpler by just
> splitting out the stuff that's irrelevant for Solaris:
>
> :Evaluate:
>   resolveExistingFilename[s_String]:=Module[{first=First[Characters[s]],drive,os,fileinfo,thefile},
>    Switch[os=$OperatingSystem,
>     "Unix", (* a whole bunch of stuff here *),
>    _, (* a whole bunch of stuff here *)]]
>
> which is to say, just delete all of the lines from the line beginning with
> "MacOS" to the line immediately preceding the one beginning with '_'.
>
> Or, you could rewrite your code in terms of Experimental`BinaryImport[] and
> Experimental`BinaryExport[], which is somewhat faster than FastBinaryFiles
> these days.
>
> Sincerely,
>
> John Fultz
> jfultz at wolfram.com
> User Interface Group
> Wolfram Research, Inc.
>



  • Prev by Date: Problem with the GaussianQuadratureWeights[n, a, b]
  • Next by Date: Re: Pattern match exactly 0 or 1 times?
  • Previous by thread: Re: Mathlink probs under Unix
  • Next by thread: Re: Mathlink probs under Unix