Re: Unknown data type [message #42106 is a reply to message #42102] |
Thu, 30 December 2004 06:19  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Julio writes:
> The files I want to read haven't any typical format. Each file has
> information in the first line (like number of rows and columns), but
> anything about data type�
>
> So, I followed the tips of David. I carried out a "trial read" using�
>
> Data_type=integer ; I assume all the files are integer
> ON_IOERROR, bad
> OPENR,lun, arq, /GET_lun
> test = make_array(nc, nl,/integer)
> READU, lun, test ; reading the file into an integer array
> GOTO, Ok
> bad: data_type=byte ; if the file coudn't be read into an integer
> array
> Ok: FREE_LUN, lun
>
> As I told you first, I have only two possible data types: byte and
> integer. So, using it, I could solve the problem.
Oh, golly, if you know how *much* data is suppose to
be in the file even I could tell you whether your file
contains bytes or integers, all the way from Colorado!
And I wouldn't have to read the file to know. Just
compare the product of rows and columns to the size
of the file (obtained with FSTAT). If there is little
or no difference, you have bytes. If there is a big
difference, you have integers. :-)
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|