From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ccc96dfdd6a003a7 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-08-10 14:28:06 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!cpk-news-hub1.bbnplanet.com!cambridge1-snf1.gtei.net!news.gtei.net!bos-service1.ext.raytheon.com!dfw-service2.ext.raytheon.com.POSTED!not-for-mail Message-ID: <3B7451E9.435B93FD@raytheon.com> From: Mark Johnson Reply-To: mark_h_johnson@raytheon.com X-Mailer: Mozilla 4.78 [en] (X11; U; Linux 2.4.6-3.1smp i686) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Reading variable-length records from a file References: <9l19l4$45m$1@slb7.atl.mindspring.net> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Fri, 10 Aug 2001 16:28:09 -0500 NNTP-Posting-Host: 192.27.48.41 X-Complaints-To: news@ext.ray.com X-Trace: dfw-service2.ext.raytheon.com 997478885 192.27.48.41 (Fri, 10 Aug 2001 16:28:05 CDT) NNTP-Posting-Date: Fri, 10 Aug 2001 16:28:05 CDT Organization: Raytheon Company Xref: archiver1.google.com comp.lang.ada:11783 Date: 2001-08-10T16:28:09-05:00 List-Id: 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.