comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » problem reading Fortran binary file
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
problem reading Fortran binary file [message #70246] Thu, 25 March 2010 10:19
Thibault Garel is currently offline  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!
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Pca in Idl
Next Topic: Re: problem reading Fortran binary file

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:58:53 PDT 2025

Total time taken to generate the page: 0.00431 seconds