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-Thread: 103376,8d5bda3619cce0f8 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news1.google.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!cyclone1.gnilink.net!gnilink.net!wns13feed!worldnet.att.net!attbi_s21.POSTED!53ab2750!not-for-mail From: "Jeffrey R. Carter" User-Agent: Thunderbird 2.0.0.19 (Windows/20081209) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: C getchar() functionality in Ada References: <4999ce31$0$90266$14726298@news.sunsite.dk> <3apeng.mtg.ln@hunter.axlog.fr> In-Reply-To: <3apeng.mtg.ln@hunter.axlog.fr> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 173.16.158.68 X-Complaints-To: abuse@mchsi.com X-Trace: attbi_s21 1234903136 173.16.158.68 (Tue, 17 Feb 2009 20:38:56 GMT) NNTP-Posting-Date: Tue, 17 Feb 2009 20:38:56 GMT Organization: AT&T ASP.att.net Date: Tue, 17 Feb 2009 20:38:56 GMT Xref: g2news2.google.com comp.lang.ada:4652 Date: 2009-02-17T20:38:56+00:00 List-Id: Jean-Pierre Rosen wrote: > > Therefore, your program should look like: > with Ada.Text_IO; use Ada.Text_IO; > procedure Ito is > C : Character; > begin > while not End_Of_File loop > if End_Of_Line then > Skip_Line; > New_Line; > else > Get (Item => C); > Put (Item => C); > end if; > end loop; > end Ito; Except that, given a file that ends with a blank line, Ada.Text_IO.End_Of_File may return True before the final blank line has been detected. The general rule is to not use Ada.Text_IO.End_Of_File, and handle the resulting End_Error. -- Jeff Carter "This trial is a travesty. It's a travesty of a mockery of a sham of a mockery of a travesty of two mockeries of a sham. ... Do you realize there's not a single homosexual on that jury?" Bananas 27