comp.lang.ada
 help / color / mirror / Atom feed
From: Matthew Heaney <matthew_heaney@acm.org>
Subject: Re: How to get a character?
Date: 1999/04/10
Date: 1999-04-10T00:00:00+00:00	[thread overview]
Message-ID: <m33e28zt36.fsf@mheaney.ni.net> (raw)
In-Reply-To: 370EE07D.67C71458@dave-world.net

Ben Barth <bebart@dave-world.net> writes:

> 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.  

Try Get_Line.  


> 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.

Yup.  Use Get_Line.

  <display info>

  Put_Line ("Hit any key to continue");

  declare
    Line : String (1 .. 20);  
    Last : Natural;
  begin
    Get_Line (Line, Last);
  end;

  <continue with program>



> I used the Text_IO.Get() function but that didn't seem to work very
> well.

That function only returns only readable characters, and keeps consuming
the line terminator until it finds one.  In this case, this is not the
behavior you want.

I made a post on this topic a week or two ago, with the title "weird
get_line".  You can look it up at DejaNews.

<http://www.dejanews.com/>

> I was also wondering if there was a way to format output to the screen
> ala C which uses "\t" for a tab.

Try ASCII.HT.  Set_Column (Set_Col?) might be better, though.









  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 ` David C. Hoos, Sr.
1999-04-12  0:00   ` Jeff Carter
1999-04-12  0:00     ` Robert Dewar
1999-04-12  0:00     ` Larry Kilgallen
1999-04-10  0:00 ` Matthew Heaney [this message]
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               ` Larry Kilgallen
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             ` JS
1999-04-14  0:00               ` Robert Dewar
1999-04-19  0:00                 ` Robert A Duff
replies disabled

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