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=0.2 required=5.0 tests=BAYES_00,FREEMAIL_FROM, INVALID_MSGID,REPLYTO_WITHOUT_TO_CC 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: Mats Weber Subject: Re: End_Of_File does not work as expected... Date: 2000/11/26 Message-ID: <3A218E36.709F71BE@mail.com>#1/1 X-Deja-AN: 698023132 Content-Transfer-Encoding: 7bit References: <3A20EFFD.5EE29272@mail.com> <3A218010.819FFAC5@acm.org> X-Accept-Language: en,pdf Content-Type: text/plain; charset=us-ascii Organization: VTX Services SA Mime-Version: 1.0 Reply-To: matsw@mail.com Newsgroups: comp.lang.ada Date: 2000-11-26T00:00:00+00:00 List-Id: Jeff Carter wrote: > 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. Sorry, I meant cat, not echo. > > 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. No, it won't raise End_Error in either case, because Get(Character) starts by skipping any number of line and page terminators and returns the first character after them. It will only raise End_Error if a file terminator is after the sequence of line and page terminators. > My advice would be to use a Get_Line function and Put_Line, and have a > handler for End_Error. Agreed.