comp.lang.ada
 help / color / mirror / Atom feed
From: Matthew J Heaney <mheaney@on2.com>
Subject: Re: Trouble with TEXT_IUO on WinNT
Date: 2000/07/13
Date: 2000-07-13T00:00:00+00:00	[thread overview]
Message-ID: <7r4s5uhyx2.fsf@butter.albany.duck.com> (raw)
In-Reply-To: 395C97C9.43607F8E@icn.siemens.de

Alfred Hilscher <Alfred.Hilscher@icn.siemens.de> writes:

Don't use End_Of_Line.  To determine whether you've read all of the
current line, do this:

  Line : String (1 .. 255);
  Last : Natural;
begin

  Get_Line (Line, Last);

  if Last < Line'Last then
    --yes, we've read the entire line
  else
    --no, we have not read the entire line
  end if;


To iterate through a file comprising lines of text, where the maximum
length of lines isn't known, then you can do this:

declare
   function Get_Line return String is
     Line : String (1 .. 256);
     Last : Natural;
   begin
     Get_Line (Line, Last);

     if Last < Line'Last then
        return Line (1 .. Last);
     else
        return Line & Get_Line;
     end if;
begin
   while not End_Of_File loop
   declare
      Line : constant String := Get_Line;
   begin
      <do something with Line>
   end;
   end loop;
end;


If you don't understand why you shouldn't use End_of_Line, then surf the
AdaPower website for the article I wrote re the "Get_Line mystery."

<http://www.adapower.com/lang/get_line.html>








       reply	other threads:[~2000-07-13  0:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <395C97C9.43607F8E@icn.siemens.de>
2000-07-13  0:00 ` Matthew J Heaney [this message]
2000-07-14  0:00   ` Trouble with TEXT_IUO on WinNT Alfred Hilscher
replies disabled

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