comp.lang.ada
 help / color / mirror / Atom feed
From: "Jeffrey R. Carter" <spam.jrcarter.not@spam.acm.org>
Subject: Re: C getchar() functionality in Ada
Date: Tue, 17 Feb 2009 20:38:56 GMT
Date: 2009-02-17T20:38:56+00:00	[thread overview]
Message-ID: <AfFml.576110$yE1.82541@attbi_s21> (raw)
In-Reply-To: <3apeng.mtg.ln@hunter.axlog.fr>

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



  parent reply	other threads:[~2009-02-17 20:38 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-16 20:36 C getchar() functionality in Ada Thomas Locke
2009-02-16 21:43 ` Jeffrey R. Carter
2009-02-17  7:23   ` Thomas Locke
2009-02-17  8:16     ` Niklas Holsti
2009-02-17 13:01       ` Georg Bauhaus
2009-02-17 22:03         ` Thomas Locke
2009-03-03  8:57         ` David Thompson
2009-02-17 20:48     ` Jeffrey R. Carter
2009-02-17 21:59       ` Thomas Locke
2009-02-16 23:46 ` Adam Beneschan
2009-02-17  7:19   ` Thomas Locke
2009-02-17  8:37     ` Jacob Sparre Andersen
2009-02-17 17:31       ` Keith Thompson
2009-02-17 14:57     ` Hibou57 (Yannick Duchêne)
2009-02-17 14:55   ` Hibou57 (Yannick Duchêne)
2009-02-17 10:37 ` m.collado
2009-02-17 22:07   ` Thomas Locke
2009-02-17 16:40 ` Jean-Pierre Rosen
2009-02-17 19:46   ` Thomas Locke
2009-02-17 20:24     ` Hyman Rosen
2009-02-17 23:44       ` Robert A Duff
2009-02-18  5:44         ` anon
2009-02-18  0:39       ` Adam Beneschan
2009-02-18  7:43     ` Jean-Pierre Rosen
2009-02-18 11:42       ` christoph.grein
2009-02-17 20:38   ` Jeffrey R. Carter [this message]
2009-02-18  7:46     ` Jean-Pierre Rosen
2009-02-18 10:41       ` christoph.grein
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox