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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,7f7e3d24b1fe22fd X-Google-Attributes: gid103376,public From: Jeff Carter Subject: Re: End_Of_File does not work as expected... Date: 2000/11/26 Message-ID: <3A218010.819FFAC5@acm.org>#1/1 X-Deja-AN: 697999067 Content-Transfer-Encoding: 7bit References: <3A20EFFD.5EE29272@mail.com> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 975274013 158.252.123.184 (Sun, 26 Nov 2000 13:26:53 PST) Organization: EarthLink Inc. -- http://www.EarthLink.net MIME-Version: 1.0 NNTP-Posting-Date: Sun, 26 Nov 2000 13:26:53 PST Newsgroups: comp.lang.ada Date: 2000-11-26T00:00:00+00:00 List-Id: 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