comp.lang.ada
 help / color / mirror / Atom feed
From: Mark Johnson <mark_h_johnson@raytheon.com>
Subject: Re: Reading variable-length records from a file
Date: Fri, 10 Aug 2001 16:28:09 -0500
Date: 2001-08-10T16:28:09-05:00	[thread overview]
Message-ID: <3B7451E9.435B93FD@raytheon.com> (raw)
In-Reply-To: 9l19l4$45m$1@slb7.atl.mindspring.net

Brian Catlin wrote:

> What is the best method for reading variable-length records from a file, using Ada (generic Ada, or GNAT)?  I have some files, from
> a VMS system, that I want to read on a Win2K system.  The files have the VMS standard "implied carriage control", which means that
> each "record" (or line; it's a text file) has a two-byte count value, followed by "count" bytes (characters).
>
>  -Brian

An ugly way to do it would be to write a "VMS_get_line" procedure to...
 - read the two characters to generate the line length (c2'pos*256+c1'pos)
 - read that many characters (and Pad as Larry mentioned)
and call that in lieu of Text_IO.Get_Line.

(or are you looking for a plug replacement so you can use Integer_IO... that would be harder)

  --Mark
PS: I could make a snide comment about it being easier to do in C, but that would be flame bait.






  parent reply	other threads:[~2001-08-10 21:28 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-08-10 18:37 Reading variable-length records from a file Brian Catlin
2001-08-10 19:04 ` Larry Kilgallen
2001-08-10 21:28 ` Mark Johnson [this message]
2001-08-13  8:14 ` Thierry Lelegard
2001-08-13 17:39   ` Brian Catlin
2001-08-13 18:29     ` tmoran
2001-08-13 18:51     ` Larry Kilgallen
  -- strict thread matches above, loose matches on Subject: below --
2001-08-13 21:29 Gautier Write-only-address
2001-08-13 22:41 ` Larry Kilgallen
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox