Read Binarys Problem and Linux

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I have a program that reads a binary data file in Unix and works just
fine, however when I tried it in Linux the read and unpack commands did
not give me the same answer.  I am trying to simply read a short
integer.  In Unix, the $nscan is around 20000, in linux it is a huge
number or even negative.  I belive that the problem has to do with
bigendian vs littleendian, but when I try different combinations of
unpack options nothing works.

 open(F, "$filein") or die "Unable to open file";
 read(F,$packscans, 4);
 $nscan = unpack("i*",$packscans);

Re: Read Binarys Problem and Linux

Tex wrote:
Quoted text here. Click to load it

Can you post the output of 'dd if=<file> bs=4 count=1 | OD -TXc'?
WRT endianness: what is the processor of the Unix box and what is Linux
running on?

Josef Möllers (Pinguinpfleger bei FSC)
    If failure had no penalty success would not be a prize
                        -- T.  Pratchett

Site Timeline