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 Path: g2news1.google.com!news2.google.com!news.glorb.com!feeder.erje.net!news2.arglkargh.de!nuzba.szn.dk!news.jacob-sparre.dk!news.szn.dk!pnx.dk!dotsrc.org!filter.dotsrc.org!news.dotsrc.org!not-for-mail Date: Tue, 17 Feb 2009 20:46:56 +0100 From: Thomas Locke User-Agent: Thunderbird 2.0.0.19 (X11/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: 8bit Message-ID: <499b1430$0$90267$14726298@news.sunsite.dk> Organization: SunSITE.dk - Supporting Open source NNTP-Posting-Host: 83.91.213.86 X-Trace: news.sunsite.dk DXC=gk2=G@da\78=M\fUi`VZVB:n12GabIS120 X-Complaints-To: staff@sunsite.dk Xref: g2news1.google.com comp.lang.ada:3677 Date: 2009-02-17T20:46:56+01:00 List-Id: Jean-Pierre Rosen wrote: > Thomas Locke a �crit : > A simple problem, a simple solution. That was exactly what I thought! :o) > In Ada, an end of line is not a character. Full stop. We have operations > that deal with end of lines: new_line, skip_line, and end_of_line. > > 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; This program *almost* work exactly as the C version, but not quite. It fails to recognize all EOL's in files, and it behaves a bit "odd" when feeding data to it using the keyboard. But I understand what you're saying: No end of line characters in Ada! Except perhaps when using Get_Immediate and Look_Ahead? /Thomas