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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,cde9c3ceb8a662ac X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-06-29 17:31:50 PST Path: archiver1.google.com!newsfeed.google.com!sn-xit-02!supernews.com!newsfeed.direct.ca!look.ca!newsfeed1.earthlink.net!newsfeed.earthlink.net!newsmaster1.prod.itd.earthlink.net!newsread1.prod.itd.earthlink.net.POSTED!not-for-mail Message-ID: <3B3D1D97.55E372C8@acm.org> From: Jeffrey Carter X-Mailer: Mozilla 4.7 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Is this explanation correct? References: Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Sat, 30 Jun 2001 00:30:28 GMT NNTP-Posting-Host: 158.252.128.64 X-Complaints-To: abuse@earthlink.net X-Trace: newsread1.prod.itd.earthlink.net 993861028 158.252.128.64 (Fri, 29 Jun 2001 17:30:28 PDT) NNTP-Posting-Date: Fri, 29 Jun 2001 17:30:28 PDT Organization: EarthLink Inc. -- http://www.EarthLink.net X-Received-Date: Fri, 29 Jun 2001 17:28:15 PDT (newsmaster1.prod.itd.earthlink.net) Xref: archiver1.google.com comp.lang.ada:9273 Date: 2001-06-30T00:30:28+00:00 List-Id: "chris.danx" wrote: > > A newbie posted asking > > "There is something I don't understand about > end_of_file stuff. When I key in my data on the file in the floppy drive, if > I leave and save a space after the end data, I will get an End_Error . but > when I open the file back, and get rid of that space and save, and run the > program it works fine. can you tell me why?" > > I want to check this before I relay it to the mailing list. > > The program uses Ada.Integer_text_io which ignores spaces, so when the program > get's to the space it thinks there's an integer after it and it doesn't find > one, so it generates the end_error (exception) to let us know. > > Is this correct? It might be better to say that, with the space at the end of the file, Ada.Integer_Text_IO.Get will stop before the space, so End_Of_File will return False. Then the next call to Ada.Integer_Text_IO.Get will read past the end of file looking for an Integer, causing End_Error to be raised. With the space removed, Ada.Integer_Text_IO.Get will stop before the line/page/file terminator, so End_Of_File will return True, and the program will terminate normally. -- Jeff Carter "I wave my private parts at your aunties." Monty Python & the Holy Grail