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

Re: carriage-return-carriage-control



Lucas Miller wrote:

> I'm working on a vax with IDL 4.0  :)  I have a HUGE binary file,
> with sequential, variable length records separated by a carriage return
> carriage control character.  The problem is that the records aren't in the

I don't know exactly what this carriage control stuff ist... can the
next record be identified just by finding the carrage returns (CR, ASCII
code 13)?

> right order!  Each record has a header with a time stamp that I can use to
> sort the file with.  Any suggestions on how to read from the file and figure
> out where each record begins?  I've tried so many things!  Please help!

If your file fits completely into memory (if it's HUGE it probably
doesn't), read it via READU:

openr, unit, filename, /get_lun
array = bytarr( (fstat(unit)).size )
readu, unit, array
free_lun, unit
record_start = where( array eq 13b, n ) + 1
timestamps = array[record_start]
; or something like that, depending on how this timestamp is defined
sort_index = sort( timestamps )

If your file is too huge, try reading it in chunks, and have a look at
the ASSOC() function.

        Alex
-- 
  Alex Schuster     Wonko@planet-interkom.de
                    alex@pet.mpin-koeln.mpg.de