This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
how to read out binary data
- To: gccbug <gcc-bugs at gcc dot gnu dot org>, gcchelp <gcc-help at gcc dot gnu dot org>
- Subject: how to read out binary data
- From: Bomin Sun <bsun at whoi dot edu>
- Date: Tue, 16 Jan 2001 22:09:27 -0500
hello,
the linux system I am using is installed in the pc with intel III.
I have a problem in reading binary data file (e.g., a binary file
(integer*2) downloaded from a website) using a fortran program under my
linux environment.
The program (also was provided by those data people) to read the file
is:
integer*2 isea(100,100)
open(1,file='seatemp.dat',form='unformatted')
read(1) isea
print*,isea(1,1)
stop
end
I used g77 to compile that program. The output from that program is
totally wrong.
for example, the value of isea(1,1) is a very large integer number.
does anyone know how to correctly read out the binary data ?
thanks!
--
Bomin Sun
Physical Oceanography Department
MS#21, 360 Woods Hole Road
Woods Hole Oceanographic Institution
Woods Hole, MA 02543
Tel:508-2893365
Fax:508-4572181