Reading binary file generated from 32-bit machine using 64-bit machine 
Author Message
 Reading binary file generated from 32-bit machine using 64-bit machine

Hi all,

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. However, this still doesn't seem to work. I just
can't read the binary file despite so many different trial. Can you
please help me what to do?

Thanks all,

Yonas



Thu, 13 May 2010 16:34:31 GMT  
 Reading binary file generated from 32-bit machine using 64-bit machine

Quote:
> 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.* .

Quote:
>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?



Thu, 13 May 2010 17:54:19 GMT  
 Reading binary file generated from 32-bit machine using 64-bit machine

Quote:

> > 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.

Quote:
> 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

Thanks again.

Yonas



Fri, 14 May 2010 02:01:08 GMT  
 Reading binary file generated from 32-bit machine using 64-bit machine

Quote:



>>> 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



Fri, 14 May 2010 03:31:57 GMT  
 Reading binary file generated from 32-bit machine using 64-bit machine


Quote:



> >>> 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- Hide quoted text -

> - Show quoted text -

Hi Louis,

I think you understood my problem well enough. In fact the file is
unformated with four bytes record length before and after each data.
In the case of binary file, i think we don't have those record lengths
and the file is treated as a continuous stream of bytes.

Yes Louis, i run the program on 32-bit machine using same gfortran and
it works well (i.e. the program can read the unformatted file
properly).

Yonas



Fri, 14 May 2010 04:23:00 GMT  
 Reading binary file generated from 32-bit machine using 64-bit machine

Quote:






>>>>> 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- Hide quoted text -

>> - Show quoted text -

> Hi Louis,

> I think you understood my problem well enough. In fact the file is
> unformated with four bytes record length before and after each data.
> In the case of binary file, i think we don't have those record lengths
> and the file is treated as a continuous stream of bytes.

> Yes Louis, i run the program on 32-bit machine using same gfortran and
> it works well (i.e. the program can read the unformatted file
> properly).

I have no clue, just more (possibly stupid) questions:

Can you dump the first few bytes of your input file and post them?  (I
would use "od -txC input_file | head".)

Do you have a program that just reads the first record into an array and
prints it?

Louis



Fri, 14 May 2010 04:42:18 GMT  
 Reading binary file generated from 32-bit machine using 64-bit machine


Quote:






> >>>>> 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- Hide quoted text -

> >> - Show quoted text -

> > Hi Louis,

> > I think you understood my problem well enough. In fact the file is
> > unformated with four bytes record length before and after each data.
> > In the case of binary file, i think we don't have those record lengths
> > and the file is treated as a continuous stream of bytes.

> > Yes Louis, i run the program on 32-bit machine using same gfortran and
> > it works well (i.e. the program can read the unformatted file
> > properly).

> I have no clue, just more (possibly stupid) questions:

> Can you dump the first few bytes of your input file and post them?  (I
> would use "od -txC input_file | head".)

> Do you have a program that just reads the first record into an array and
> prints it?

> Louis- Hide quoted text -

> - Show quoted text -

Hi,

Here is the first record of the file generated following your
suggustion. May be you can make sense out of it but i have no clue.

Thanks again

Yonas

0000000 34 00 00 00 02 00 00 00 0c 00 00 00 00 00 00 00
0000020 40 6f 44 41 00 00 00 00 38 13 7e 41 20 20 20 20
0000040 20 20 20 20 20 20 20 20 48 45 41 44 46 01 00 00
0000060 a5 00 00 00 01 00 00 00 34 00 00 00 f0 90 06 00
0000100 00 00 00 00 00 38 8f c0 00 00 00 00 00 38 8f c0
*
0014440 e1 7a 14 ae 47 58 a7 40 8f c2 f5 28 dc 4b a7 40
0014460 85 eb 51 b8 9e 3b a7 40 cd cc cc cc 4c 2b a7 40
0014500 00 00 00 00 00 1b a7 40 b8 1e 85 eb d1 0a a7 40
0014520 00 00 00 00 80 fa a6 40 52 b8 1e 85 eb e9 a6 40



Fri, 14 May 2010 06:50:50 GMT  
 Reading binary file generated from 32-bit machine using 64-bit machine


Quote:






> >>>>> 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- Hide quoted text -

> >> - Show quoted text -

> > Hi Louis,

> > I think you understood my problem well enough. In fact the file is
> > unformated with four bytes record length before and after each data.
> > In the case of binary file, i think we don't have those record lengths
> > and the file is treated as a continuous stream of bytes.

> > Yes Louis, i run the program on 32-bit machine using same gfortran and
> > it works well (i.e. the program can read the unformatted file
> > properly).

> I have no clue, just more (possibly stupid) questions:

> Can you dump the first few bytes of your input file and post them?  (I
> would use "od -txC input_file | head".)

> Do you have a program that just reads the first record into an array and
> prints it?

> Louis- Hide quoted text -

> - Show quoted text -

Hi,

Here is the first record generated following your suggustion. May be
you can make a sense out of it but i am still clueless.

Thanks again

Yonas
0000000 34 00 00 00 02 00 00 00 0c 00 00 00 00 00 00 00
0000020 40 6f 44 41 00 00 00 00 38 13 7e 41 20 20 20 20
0000040 20 20 20 20 20 20 20 20 48 45 41 44 46 01 00 00
0000060 a5 00 00 00 01 00 00 00 34 00 00 00 f0 90 06 00
0000100 00 00 00 00 00 38 8f c0 00 00 00 00 00 38 8f c0
*
0014440 e1 7a 14 ae 47 58 a7 40 8f c2 f5 28 dc 4b a7 40
0014460 85 eb 51 b8 9e 3b a7 40 cd cc cc cc 4c 2b a7 40
0014500 00 00 00 00 00 1b a7 40 b8 1e 85 eb d1 0a a7 40
0014520 00 00 00 00 80 fa a6 40 52 b8 1e 85 eb e9 a6 40



Fri, 14 May 2010 06:52:44 GMT  
 Reading binary file generated from 32-bit machine using 64-bit machine

Quote:








> > >>>>> 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- Hide quoted text -

> > >> - Show quoted text -

> > > Hi Louis,

> > > I think you understood my problem well enough. In fact the file is
> > > unformated with four bytes record length before and after each data.
> > > In the case of binary file, i think we don't have those record lengths
> > > and the file is treated as a continuous stream of bytes.

> > > Yes Louis, i run the program on 32-bit machine using same gfortran and
> > > it works well (i.e. the program can read the unformatted file
> > > properly).

> > I have no clue, just more (possibly stupid) questions:

> > Can you dump the first few bytes of your input file and post them?  (I
> > would use "od -txC input_file | head".)

> > Do you have a program that just reads the first record into an array and
> > prints it?

> > Louis- Hide quoted text -

> > - Show quoted text -

> Hi,

> Here is the first record of the file generated following your
> suggustion. May be you can make sense out of it but i have no clue.

> Thanks again

> Yonas

> 0000000 34 00 00 00 02 00 00 00 0c 00 00 00 00 00 00 00
> 0000020 40 6f 44 41 00 00 00 00 38 13 7e 41 20 20 20 20
> 0000040 20 20 20 20 20 20 20 20 48 45 41 44 46 01 00 00
> 0000060 a5 00 00 00 01 00 00 00 34 00 00 00 f0 90 06 00
> 0000100 00 00 00 00 00 38 8f c0 00 00 00 00 00 38 8f c0
> *
> 0014440 e1 7a 14 ae 47 58 a7 40 8f c2 f5 28 dc 4b a7 40
> 0014460 85 eb 51 b8 9e 3b a7 40 cd cc cc cc 4c 2b a7 40
> 0014500 00 00 00 00 00 1b a7 40 b8 1e 85 eb d1 0a a7 40
> 0014520 00 00 00 00 80 fa a6 40 52 b8 1e 85 eb e9 a6 40- Hide quoted text -

> - Show quoted text -

Here is the corresponding array:
2      925   2678400.00000000  2461471200.00000   Head     326  165     1


Fri, 14 May 2010 06:57:27 GMT  
 Reading binary file generated from 32-bit machine using 64-bit machine

Quote:










>>>>>>>> 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- Hide quoted text -
>>>>> - Show quoted text -
>>>> Hi Louis,
>>>> I think you understood my problem well enough. In fact the file is
>>>> unformated with four bytes record length before and after each data.
>>>> In the case of binary file, i think we don't have those record lengths
>>>> and the file is treated as a continuous stream of bytes.
>>>> Yes Louis, i run the program on 32-bit machine using same gfortran and
>>>> it works well (i.e. the program can read the unformatted file
>>>> properly).
>>> I have no clue, just more (possibly stupid) questions:
>>> Can you dump the first few bytes of your input file and post them?  (I
>>> would use "od -txC input_file | head".)
>>> Do you have a program that just reads the first record into an array and
>>> prints it?
>>> Louis- Hide quoted text -
>>> - Show quoted text -
>> Hi,

>> Here is the first record of the file generated following your
>> suggustion. May be you can make sense out of it but i have no clue.

>> Thanks again

>> Yonas

>> 0000000 34 00 00 00 02 00 00 00 0c 00 00 00 00 00 00 00
>> 0000020 40 6f 44 41 00 00 00 00 38 13 7e 41 20 20 20 20
>> 0000040 20 20 20 20 20 20 20 20 48 45 41 44 46 01 00 00
>> 0000060 a5 00 00 00 01 00 00 00 34 00 00 00 f0 90 06 00
>> 0000100 00 00 00 00 00 38 8f c0 00 00 00 00 00 38 8f c0
>> *
>> 0014440 e1 7a 14 ae 47 58 a7 40 8f c2 f5 28 dc 4b a7 40
>> 0014460 85 eb 51 b8 9e 3b a7 40 cd cc cc cc 4c 2b a7 40
>> 0014500 00 00 00 00 00 1b a7 40 b8 1e 85 eb d1 0a a7 40
>> 0014520 00 00 00 00 80 fa a6 40 52 b8 1e 85 eb e9 a6 40- Hide quoted text -

>> - Show quoted text -

> Here is the corresponding array:
> 2      925   2678400.00000000  2461471200.00000   Head        326  165     1

Interesting...

Your first record is 52 (hex 34) bytes, and your second looks like it's
430320 (hex 0690f0) bytes long.  Does that sound OK?  The dumped bytes
starting at offset (octal) 0014440 -- are they at the end of the file?
Did you transfer the file from another machine?  If so, is it possible
that the file was somehow truncated in transit?  Do the file size and
checksum match across machines?

One thing to try is a program that opens the file and loops reading
records with no I/O list and printing the record number after each
successful read.  This will help you figure out where you're getting the
end of file condition.

Louis



Fri, 14 May 2010 08:48:06 GMT  
 Reading binary file generated from 32-bit machine using 64-bit machine

Quote:
>> 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

   You can also generate a small test file on the two machines,
   with the same program, various compiler options,
   and compare the bytes with http://tboudet.free.fr/hexdiff/

   Work nice for me in the same situation...

--
No sig available for this very specific troll.



Fri, 14 May 2010 09:16:55 GMT  
 Reading binary file generated from 32-bit machine using 64-bit machine

Quote:

>>0000000 34 00 00 00 02 00 00 00 0c 00 00 00 00 00 00 00

           52 bytes   |    2       |   12      |

Quote:
>>0000020 40 6f 44 41 00 00 00 00 38 13 7e 41 20 20 20 20

          2678400D0   |  31536000D0           |  (blanks

Quote:
>>0000040 20 20 20 20 20 20 20 20 48 45 41 44 46 01 00 00

                                    H  E  A  D| 326

Quote:
>>0000060 a5 00 00 00 01 00 00 00 34 00 00 00 f0 90 06 00

             165      |      1     | end 52 bytes

(snip)

Quote:
> Here is the corresponding array:
> 2      925   2678400.00000000  2461471200.00000   Head        326  165     1

It seems that some are a little off.  Also, be sure to indicate single
or double precision, and read them back the same way as written.

-- glen



Fri, 14 May 2010 10:32:54 GMT  
 Reading binary file generated from 32-bit machine using 64-bit machine

Quote:

> >>0000000 34 00 00 00 02 00 00 00 0c 00 00 00 00 00 00 00

>            52 bytes   |    2       |   12      |

> >>0000020 40 6f 44 41 00 00 00 00 38 13 7e 41 20 20 20 20

>           2678400D0   |  31536000D0           |  (blanks

> >>0000040 20 20 20 20 20 20 20 20 48 45 41 44 46 01 00 00

>                                     H  E  A  D| 326

> >>0000060 a5 00 00 00 01 00 00 00 34 00 00 00 f0 90 06 00

>              165      |      1     | end 52 bytes

> (snip)

> > Here is the corresponding array:
> > 2      925   2678400.00000000  2461471200.00000   Head        326  165     1

> It seems that some are a little off.  Also, be sure to indicate single
> or double precision, and read them back the same way as written.

> -- glen

Thanks all,

I am learning a lot here. Let me take sometime and digest all your
messages and will let you know how it goes.

Thanks again

Yonas



Fri, 14 May 2010 11:04:42 GMT  
 Reading binary file generated from 32-bit machine using 64-bit machine

Quote:

> >>0000000 34 00 00 00 02 00 00 00 0c 00 00 00 00 00 00 00

>            52 bytes   |    2       |   12      |

> >>0000020 40 6f 44 41 00 00 00 00 38 13 7e 41 20 20 20 20

>           2678400D0   |  31536000D0           |  (blanks

> >>0000040 20 20 20 20 20 20 20 20 48 45 41 44 46 01 00 00

>                                     H  E  A  D| 326

> >>0000060 a5 00 00 00 01 00 00 00 34 00 00 00 f0 90 06 00

>              165      |      1     | end 52 bytes

> (snip)

> > Here is the corresponding array:
> > 2      925   2678400.00000000  2461471200.00000   Head        326  165     1

> It seems that some are a little off.  Also, be sure to indicate single
> or double precision, and read them back the same way as written.

> -- glen

I am really sorry glen. You are absolutly right the above array
(2      925   2678400.00000000  2461471200.00000   Head        326
165     1 ) is for this binary (i mixed up some files).

0000000 34 00 00 00 02 00 00 00 9d 03 00 00 00 00 00 00
0000020 40 6f 44 41 00 00 00 3c e2 56 e2 41 20 20 20 20
0000040 20 20 20 20 20 20 20 20 48 45 41 44 46 01 00 00
0000060 a5 00 00 00 01 00 00 00 34 00 00 00 f0 90 06 00
0000100 00 00 00 00 00 38 8f c0 00 00 00 00 00 38 8f c0
*
0014440 e1 7a 14 ae 47 58 a7 40 8f c2 f5 28 dc 4b a7 40
0014460 85 eb 51 b8 9e 3b a7 40 cd cc cc cc 4c 2b a7 40
0014500 00 00 00 00 00 1b a7 40 b8 1e 85 eb d1 0a a7 40
0014520 00 00 00 00 80 fa a6 40 52 b8 1e 85 eb e9 a6 40

I converted the above binary and got the same array as your's. Thanks
again and sorry for the confusion.

Yonas



Fri, 14 May 2010 11:18:49 GMT  
 Reading binary file generated from 32-bit machine using 64-bit machine

Quote:


>> > 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.

Gfortran 4.1 and older uses 8 byte record marker by default both on 32
and 64 bit machines. 4.2 and newer use 4 byte markers by default on
all machines. So if you're trying to read files created on different
platforms using the same compiler version you should not need the
-frecord-marker option.

--
Janne Blomqvist



Sat, 15 May 2010 04:33:50 GMT  
 
 [ 15 post ] 

 Relevant Pages 

1. x86-64 performance: 32 bit vs 64 bit

2. top 32 bits of 64-bit product of two 32-bit integers

3. 64-Bit Hexadecimal to 64-Bit Binary

4. REQUEST: 64-bit integer math on 32-bit processor

5. g77: 32-bit to 64-bit

6. SP on a 64-bit CPU and DP on a 32-bit CPU

7. Solaris to Linux: (32 bit and 64 bit):

8. 32 bit to 64 bit:

9. Problem with zipfile between 32-bit and 64-bit

10. 64-bit vs 32-bit tclsh

11. Loading 32 bit packages under 64 bit Tclsh

12. reading 32-bit float in little endian byte order (Intel machine)

 

 
Powered by phpBB® Forum Software