comp.lang.ada
 help / color / mirror / Atom feed
* Re: Trouble with TEXT_IUO on WinNT
       [not found] <395C97C9.43607F8E@icn.siemens.de>
@ 2000-07-13  0:00 ` Matthew J Heaney
  2000-07-14  0:00   ` Alfred Hilscher
  0 siblings, 1 reply; 2+ messages in thread
From: Matthew J Heaney @ 2000-07-13  0:00 UTC (permalink / raw)


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>








^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Trouble with TEXT_IUO on WinNT
  2000-07-13  0:00 ` Trouble with TEXT_IUO on WinNT Matthew J Heaney
@ 2000-07-14  0:00   ` Alfred Hilscher
  0 siblings, 0 replies; 2+ messages in thread
From: Alfred Hilscher @ 2000-07-14  0:00 UTC (permalink / raw)


Ups, I did End_Of_Line - this should be End_Of_File. Thanks for this
hint. I think I have to clean my glasses. <g>



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

No, thats not what I want. I want skip empty and blank lines (the
End_Of_Line should be an End_Of_File to avoid an END_ERROR exception, I
mistyped it :-().


> 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."

Thats not the problem. The problem was, that I did an End_Of_Line where
it should be an End_Of_File.




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-07-14  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <395C97C9.43607F8E@icn.siemens.de>
2000-07-13  0:00 ` Trouble with TEXT_IUO on WinNT Matthew J Heaney
2000-07-14  0:00   ` Alfred Hilscher

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