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

Home » Public Forums » archive » Problem in reading 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 in reading binary file [message #80668] Wed, 27 June 2012 00:48
hadi is currently offline  hadi
Messages: 33
Registered: June 2012
Member
Dear all
I have a problem to reading a binary file that has been written by Fortran program. how I can read the binary file from fortran program. I run this command and i got this error. please see it my problem and give me solution. I am appreciating in advance. please look the program.
infile = 'C:/Users/fadaei/IDLWorkspace80/DEM.dat' ;Input file name
IDL>
IDL> OPENR, iunit, infile, /GET_LUN ;Open input file
IDL>
IDL> n = 0 ;Make n a LONG
IDL> m = 0 ;Make m a LONG
IDL> READU, iunit, n, m ;Read n and m
IDL>
IDL> i = LONARR(n, n, n) ;Create i array
IDL> z = FLTARR(m, m) ;Create z array
IDL> b = BYTARR(m, m) ;Create b array
IDL> READU, iunit, i, z, b ;Read i, z, and b
IDL>
IDL> FREE_LUN, iunit ;Close output file
IDL>
IDL> HELP, n, m, i, z, b ;Print variable info
IDL> PRINT, z[0:3,0:3] ;Print part of z
% OPENR: Error opening file. Unit: 100, File: C:\Users\fadaei\IDLWorkspace80\DEM.dat
The system cannot find the file specified.
% Error occurred at: $MAIN$
% Execution halted at: $MAIN$
% READU: Variable is undefined: IUNIT.
% Error occurred at: $MAIN$
% Execution halted at: $MAIN$
% Array dimensions must be greater than 0.
% Error occurred at: $MAIN$
% Execution halted at: $MAIN$
% Array dimensions must be greater than 0.
% Error occurred at: $MAIN$
% Execution halted at: $MAIN$
% Array dimensions must be greater than 0.
% Error occurred at: $MAIN$
% Execution halted at: $MAIN$
% READU: Variable is undefined: IUNIT.
% Error occurred at: $MAIN$
% Execution halted at: $MAIN$
% FREE_LUN: Variable is undefined: IUNIT.
% Error occurred at: $MAIN$
% Execution halted at: $MAIN$
N INT = 0
M INT = 0
I UNDEFINED = <Undefined>
Z UNDEFINED = <Undefined>
B UNDEFINED = <Undefined>
% Variable is undefined: Z.
% Error occurred at: $MAIN$
% Execution halted at: $MAIN$
best, Hadi
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: @named_structure % Error opening file. File: named_structure
Next Topic: isurface

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

Current Time: Wed Oct 08 15:26:26 PDT 2025

Total time taken to generate the page: 0.01000 seconds