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: g2news1.google.com!news1.google.com!npeer01.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!cyclone1.gnilink.net!gnilink.net!wns14feed!worldnet.att.net!attbi_s22.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> In-Reply-To: <4999ce31$0$90266$14726298@news.sunsite.dk> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: <%5lml.519385$TT4.153916@attbi_s22> NNTP-Posting-Host: 173.16.158.68 X-Complaints-To: abuse@mchsi.com X-Trace: attbi_s22 1234820603 173.16.158.68 (Mon, 16 Feb 2009 21:43:23 GMT) NNTP-Posting-Date: Mon, 16 Feb 2009 21:43:23 GMT Organization: AT&T ASP.att.net Date: Mon, 16 Feb 2009 21:43:23 GMT Xref: g2news1.google.com comp.lang.ada:3661 Date: 2009-02-16T21:43:23+00:00 List-Id: Thomas Locke wrote: > > I've started redoing all the K&R C examples in Ada, and I've already hit > a wall that I'm not able to get around. > > I have this C program: http://pastebin.com/fbc6bec5 > > It's very simple, but still I fail to mimick it in Ada. This program duplicates standard input on standard output. You are being mislead by the use of "char" in C. "char" sometimes refers to the equivalent of Ada's Character, and other times to the equivalent of System.Storage_Elements.Storage_Element or Ada.Streams.Stream_Element. This is one of the latter cases. You should not be using Character, String, or Ada.Text_IO for this. I suggest you look at streams and Ada.Text_IO.Text_Streams. -- Jeff Carter "Help! Help! I'm being repressed!" Monty Python & the Holy Grail 67