From: Jeff Carter <jrcarter@acm.org>
Subject: Re: End_Of_File does not work as expected...
Date: 2000/11/26
Date: 2000-11-26T00:00:00+00:00 [thread overview]
Message-ID: <3A218010.819FFAC5@acm.org> (raw)
In-Reply-To: 3A20EFFD.5EE29272@mail.com
Mats Weber wrote:
>
> I find Jeff Carter's reply overly pedantic and paternalistic, given the
> reasonable question being asked. And students are welcome to this newsgroup.
I was trying to allow the questioner to figure the answer out himself.
In my experience, information is more likely to be retained when figured
out than when given.
> If you want to write the equivalent of UNIX's echo using Text_IO, you
> must follow the complete file structure including lines and pages:
The UNIX echo command echoes its command line arguments, IIRC. The
questioner does not appear to be writing an equivalent program. I am not
sure what he is trying to accomplish.
>
> while not End_Of_File loop
> while not End_Of_Page loop
> while not End_Of_Line loop
> Get(c);
> Put(c);
> end loop;
> Skip_Line; -- can be omitted.
> New_Line;
> end loop;
> Skip_Page; -- can be omitted.
> New_Page;
> end loop;
If the code does not skip line terminators, then it will raise
End_Error. If the file does not contain page terminators, this code will
raise End_Error. When reading from the keyboard, End_Of_File is usually
always False.
My advice would be to use a Get_Line function and Put_Line, and have a
handler for End_Error.
--
Jeff Carter
"Nobody expects the Spanish Inquisition!"
Monty Python's Flying Circus
next prev parent reply other threads:[~2000-11-26 0:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-11-24 23:42 End_Of_File does not work as expected Mika Fischer
2000-11-25 5:14 ` Jeff Carter
2000-11-25 0:00 ` Mika Fischer
2000-11-25 0:00 ` Jeff Carter
2000-11-26 0:00 ` Mats Weber
2000-11-26 0:00 ` Jeff Carter [this message]
2000-11-26 0:00 ` Mats Weber
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox