comp.lang.ada
 help / color / mirror / Atom feed
From: "David C. Hoos, Sr." <david.c.hoos.sr@ada95.com>
Subject: Re: How to get a character?
Date: 1999/04/10
Date: 1999-04-10T00:00:00+00:00	[thread overview]
Message-ID: <E5joh01g#GA.220@pet.hiwaay.net> (raw)
In-Reply-To: 370EE07D.67C71458@dave-world.net


Ben Barth wrote in message <370EE07D.67C71458@dave-world.net>...
>I was wondering if there was a way to get a character in Ada from the
>user such as the getchar() function that can be used in C.  I'm trying
>to add a stop after displaying some information to the screen so the
>user can press any key to continue with the program.  I used the
>Text_IO.Get() function but that didn't seem to work very well.
>
If you really want him to just press any key, and only one key,
then in Ada95, you can use text_io.Get_immediate -- the one with only
one parameter.  This procedure will not return until the user types
some (any) character.

If using Ada83, then, without resorting to some OS-specific or
compiler-specific code, you would use text_io.Get_Line.  However,
this will require a <return> character to return from the call.
You could, of course simply say "Press return to Continue."

>I was also wondering if there was a way to format output to the screen
>ala C which uses "\t" for a tab.
>
This one's the same in Ada83 and Ada95:

If I wanted to move to the next "tab stop" where the "stops" are at
intervals of N columns, I would do
Ada.Text_IO.Set_Col (((Ada.Text_IO.Col + N) mod N) + 1);

(of course leave off the Ada. prefix if using Ada83).






  parent reply	other threads:[~1999-04-10  0:00 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-04-10  0:00 How to get a character? Ben Barth
1999-04-10  0:00 ` Matthew Heaney
1999-04-10  0:00   ` bglbv
1999-04-10  0:00     ` Matthew Heaney
1999-04-12  0:00       ` Fraser Wilson
1999-04-13  0:00         ` Get_Immediate warning, (was: How to get a character?) JS
1999-04-13  0:00           ` Robert Dewar
1999-04-13  0:00             ` bglbv
1999-04-14  0:00               ` Robert Dewar
1999-04-14  0:00                 ` bglbv
1999-04-15  0:00                   ` Robert Dewar
1999-04-16  0:00                     ` Matthew Heaney
1999-04-16  0:00                       ` Robert Dewar
1999-04-18  0:00                         ` Jean-Pierre Rosen
1999-04-19  0:00                     ` Robert A Duff
1999-04-14  0:00               ` Larry Kilgallen
1999-04-14  0:00             ` JS
1999-04-14  0:00               ` Robert Dewar
1999-04-19  0:00                 ` Robert A Duff
1999-04-10  0:00 ` David C. Hoos, Sr. [this message]
1999-04-12  0:00   ` How to get a character? Jeff Carter
1999-04-12  0:00     ` Larry Kilgallen
1999-04-12  0:00     ` Robert Dewar
replies disabled

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