Re: Reading binary file generated from 32-bit machine using 64-bit machine



yonas_kassa@xxxxxxxxxxx wrote:
On Nov 25, 3:54 am, Thomas Koenig <tkoe...@xxxxxxxxxxxxx> wrote:
On 2007-11-25, yonas_ka...@xxxxxxxxxxx <yonas_ka...@xxxxxxxxxxx> wrote:

I am sorry if i come up with elementary question but i spend two days
trying to figure out how to read a binary file generated by gfortran
on a 32 bit i386 machine using a 64 bit x86_64 machine. i tried to use
the flag -frecord-marker=4 to change the default from 8 to 4 bytes on
64 bits machine.
Please give some details about the machines you are running on.

Which versions of gfortran do you use on the two machines?

What operating systems do you use?

The default for record markers was changed to four bytes from
(mostly) eight bytes with gfortran 4.2.0. If either of your
systems uses 4.1.*, you'll need to specify -frecord-marker=8
for gfortran 4.2.* .

However, this still doesn't seem to work. I just
can't read the binary file despite so many different trial.
What exactly does "doesn't work" mean?

Are you getting error messages / reading in the wong data / ???

Can you provide a simple example that we can corss-check?

Thanks Thomas,

I am using x86_64-suse-linux operating system. The gfortran version
is 4.1.2. The binary file (i am tried to read) was generated using
Fedora Core 6 linux on 32-bit i386 machine with the same gfortran
version.

What exactly does "doesn't work" mean?

When i complied the codes i added flag -frecord-marker=4 thinking that
will change the default from 8 to 4 bytes on my 64 bits machine.

The error message is: Fortran runtime error: End of file

Some (possibly stupid) questions:

The term "binary file" can be ambiguous; are we talking about an unformatted file?

Have you run the program that reads the file on a 32-bit machine? If so, does it work? If you haven't run the program before, is it possible that the problem has nothing to do with the length of the record marker?

If you haven't written a program that just reads the first record into an array and prints the results, you might want to try that just to see if it works.

Louis
.



Relevant Pages