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

Home » Public Forums » archive » Re: Problem in reading binary file
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Problem in reading binary file [message #80666 is a reply to message #80665] Wed, 27 June 2012 01:15 Go to previous message
Mats Löfdahl is currently offline  Mats Löfdahl
Messages: 263
Registered: January 2012
Senior Member
Den onsdagen den 27:e juni 2012 kl. 09:48:41 UTC+2 skrev fada...@gmail.com:
> 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

You may want to read the error messages. Start with the first one:

% OPENR: Error opening file. Unit: 100, File: C:\Users\fadaei\IDLWorkspace80\DEM.dat
The system cannot find the file specified.

Is the file you are trying to read actually called C:\Users\fadaei\IDLWorkspace80\DEM.dat?
[Message index]
 
Read Message
Read Message
Read Message
Previous Topic: Re: IDLnetURL Object Not Loading
Next Topic: help with imdisp

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

Current Time: Fri Oct 10 10:34:13 PDT 2025

Total time taken to generate the page: 1.03671 seconds