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

Re: reading files with date- and time - columns



Zeschke wrote:

> File : s.log
> ;DATE          TIME       n x VALUES
> 23.01.2001 08:39:41 21 21.4 0
> 23.01.2001 08:40:16 21 21.3 0
> 23.01.2001 08:40:51 21 21.3 0
> 23.01.2001 08:41:26 21 21.4 0
> 
> or such a format:
> 
> ;DATE         TIME                n x VALUES
> 2/23/2001   08:39:41.643  34.660
> 2/23/2001   08:49:41.456  34.960

  If the file is fixed format, all the columns line up, one way
  to do this is to read the entire file into a string array, then
  use strmid to pick off columns like hours, minutes, seconds.
  These may then be combined as desired.  This works quite well,
  the main problem might be getting all the lines into an array
  (if they will fit).  For unix/linux a spawn of wc gives the number
  of lines.  fstat can probably be used also to compute that number.

  Ray Sterner                     ray.sterner@jhuapl.edu 
  The Johns Hopkins University    North latitude 39.16 degrees.
  Applied Physics Laboratory      West longitude 76.90 degrees.
  Laurel, MD 20723-6099