;+ 
; function read_numbers, unit, num
; 
; ----------------------------------------= LAST CHANGED:  15-nov-00 
;PURPOSE: 
;returns array if numbers are valid, or -1 if error
; 
; ------------- revision history --------------- 
; (15-nov-00 cgz) Added documentation header
; (15-nov-00 cgz) Replaced call of NCOLS function by explicit (SIZE(var))(1)

function read_numbers, unit, num

  on_error,2
  a=-1
  f=0.0
  i=0
  while i lt num and (not eof(unit)) do begin
    readf,unit,f
    ;print,f
    if not eof(unit) then a=[a,f]
    i=i+1
  endwhile
;  if ncols(a) eq -1 then return,-1 else return, a(1:ncols(a)-1)
  if (size(a))(1) eq -1 then return,-1 else return, a(1:(size(a))(1)-1)
end


