This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: fread help!



Well, here's a guess: the binary file was created on a SPARC Solaris
machine, and you're reading it on a Wintel machine. SPARC processors
are "big-endian" and Intel processors are "little-endian." If that's
the case, then you need to byte-swap the values as you read them
in. See, for instance, the cookbook at
http://astronomy.swin.edu.au/pbourke/dataformats/pcbinary.html .

I think GI-HYEON PARK wrote:
[Charset iso-8859-1 unsupported, filtering to ASCII...]
> Hi,
> 
> I am trying to read binary file in WIN ME and it does not read data
> correctly.
> I tried the same code in solaris and it works fine..
> 
> Does anybody know why C program in WIN ME reads data wrong?



---------------------------------------------------------
Ernest Friedman-Hill  
Distributed Systems Research        Phone: (925) 294-2154
Sandia National Labs                FAX:   (925) 294-2234
Org. 8920, MS 9012                  ejfried@ca.sandia.gov
PO Box 969                  http://herzberg.ca.sandia.gov
Livermore, CA 94550

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]