FUNCTION Count_Rows, filename, MaxRows = maxrows ; This utility routine is used to count the number of ; rows in an ASCII data file. IF N_Elements(maxrows) EQ 0 THEN maxrows = 500 OpenR, lun, filename, /Get_Lun Catch, error IF error NE 0 THEN BEGIN count = count-1 RETURN, count ENDIF count = 1 line = '' FOR j=count, maxrows DO BEGIN ReadF, lun, line count = count + 1 ENDFOR RETURN, -1 END