comp.lang.ada
 help / color / mirror / Atom feed
From: Marin David Condic <mcondic.nospam@acm.org>
Subject: Re: Reading a text file
Date: 2000/10/08
Date: 2000-10-09T00:02:21+00:00	[thread overview]
Message-ID: <39E10AEF.440A3523@acm.org> (raw)
In-Reply-To: 39E09A07.BFF0DA2C@netcourrier.com

Mathias Dolidon wrote:

> Instead of "Read(Data_File, St)" write "Get_Line(Data_File, St)".
>

From the ARM 10.1(49)

49.   procedure Get_Line(File : in  File_Type;
                           Item : out String;
                           Last : out Natural);

You've got the right idea, but you will need a "Last" actual parameter, which
indicates the last character in the string.

BTW, while the exception trap will, in fact, work for detecting EOF, I'd
consider it a bit abnormal. EOF is a condition you expect to arrive at sort
of like getting to the end of an array with an index. Most people would not
terminate an array scanning loop by trapping Constraint_Error, even though
it would work. Exceptions are generally considered an indication of some
unexpected condition or error. You would not usually use them for "normal"
program conditions.

MDC
--
======================================================================
Marin David Condic - Quadrus Corporation - http://www.quadruscorp.com/
Send Replies To: m c o n d i c @ q u a d r u s c o r p . c o m
Visit my web site at:  http://www.mcondic.com/

    "Giving money and power to Government is like giving whiskey
    and car keys to teenage boys."

        --   P. J. O'Rourke
======================================================================






  reply	other threads:[~2000-10-08  0:00 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2000-10-08  0:00 Reading a text file stiletto
2000-10-08  0:00 ` Mathias Dolidon
2000-10-08  0:00   ` Marin David Condic [this message]
  -- strict thread matches above, loose matches on Subject: below --
2000-10-08  0:00 stiletto
2000-10-06  0:00 ` DPH
2000-10-06  0:00 ` DPH
replies disabled

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