Re: Q: About reading files into an array without knowing the size. [message #5337 is a reply to message #5205] |
Tue, 07 November 1995 00:00   |
mirko.vukovic
Messages: 6 Registered: November 1995
|
Junior Member |
|
|
In article <DHMELp.JDM@news.dlr.de>, H.Mannstein@dlr.de says...
>
> David van Kuijk <kuijk@mpi.nl> wrote:
> with
> OPENR,1, "filename"
> a=fstat(1)
> floatss=fltarr(a.size/4)
> READF, 1, floatss
>
> you will get what you want, but you have to know, what type of data
"filename"
> contains.
> --
> Regards,
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~
~~~~~~~~
> Hermann Mannstein Tel.: +49 8153
Well, I tried that and it does not quite work, since fstat returns the
file size in bytes. If you are reading ascii, the division by 4 (4 bytes
for floating point variables) is not correct. How many bytes/character
(0.5?)
Now, if fstat returned the number of records in a file, that would be
something usefull, provided one knew how many columns are in the file.
--
Mirko Vukovic, PhD mirko.vukovic@grc.varian.com
Varian Research Center Phone: (415) 424-4969
3075 Hansen Way, M/S K-109 Fax: (415) 424-6988
Palo Alto, CA 94304-1025
|
|
|