[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


Silly me -

Of course, you need to divide by the size of each element when using the
fstat function to get the array size:

array = fltarr( stat.size / 4 ) ;; 4 bytes to a float


>I always use the fstat routine, which gets a bunch of information about
>the file, but the only one I ever use is the size field:
>stat = fstat( lun )
>array = fltarr( stat.size )
>free_lun, lun
>Alternatively, if you're on UNIX, you can use the /nostdio keyword which
>lets you just read willy nilly until the end of the file, and then get the
>transfer count from the readu procedure. It's not a good way of doing
>things, in my opinion, but it works:
>;; Allocate a much bigger array than you need
>array = fltarr( 1e5 )
>array = temporary(array)[0:count-1]
>free_lun, lun