problem reading Fortran binary file [message #70246] |
Thu, 25 March 2010 10:19 |
Thibault Garel
Messages: 55 Registered: October 2009
|
Member |
|
|
Hi,
I am having trouble for reading with IDL a binary file i wrote in
Fortran90.
Here is how i wrote it in fortran.
open(11,file='bfile.bin',form='unformatted')
write(11) nrej,n
write(11) data(1:nrej,1:n)
close(11)
I can read it correctly in fortran but in IDL , when i do :
" nrej = 0L
n = 0L
my_file = 'bfile.bin'
a = 0.0d0
openr,unit,myfile,/get_lun
readu,unit, nrej,n
Nphot_tab = dblarr(nrej,n)
Nphot_tab(*,*) = 0.0d0
for i=0L,nrej-1L do begin
for j=0L,n-1L do begin
readu,unit,a
Nphot_tab(i,j) = a
endfor
endfor
close,unit, /file
free_lun,unit
"
it prints : READU: End of file encountered. Unit:.....
Does anybody know what i did wrong? :)
Thank you!
|
|
|