carriage-return-carriage-control [message #25890] |
Wed, 25 July 2001 15:35  |
differentiable
Messages: 5 Registered: June 2001
|
Junior Member |
|
|
Hi!
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
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!
My thanks are yours; Lucas.
|
|
|
Re: carriage-return-carriage-control [message #25961 is a reply to message #25890] |
Fri, 27 July 2001 05:21  |
Alex Schuster
Messages: 124 Registered: February 1997
|
Senior Member |
|
|
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
|
|
|