This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
32 vs. 64 bit binary files
- From: Brian McGrew <brian at visionpro dot com>
- To: <gcc-help at gcc dot gnu dot org>
- Date: Wed, 11 Nov 2009 15:22:38 -0800
- Subject: 32 vs. 64 bit binary files
So we've run into our first real snag on the conversion road from 32 to 64
bit. We write out a binary file full of data and then read it back in using
fwrite and fread.
My file format is pure binary and it's as follows:
Long height
Long width
For (short; height * width)
Long
Long
So in the 32 bit world, this works great. But when trying to read these 32
bit files into software on the 64 bit systems, I'm running into problems!
There are no delimeters in my file that I can use to determine which arch
the file was written on.
What I need is some kind of method to determine the arch, possibly based on
the file??? I don't know??? All I need to know is, from the code level, if
it's a 32-bit binary file or a 64-bit binary file?
Thanks,
-b