public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Getch() waits for a keypress...
@ 2001-04-24  7:16 Programma Computer
  2001-04-24  7:27 ` Alexandre Oliva
  0 siblings, 1 reply; 6+ messages in thread
From: Programma Computer @ 2001-04-24  7:16 UTC (permalink / raw)
  To: gcc; +Cc: support

Hello everyone.

I think a lot of other people have asked you this, but I'm a newbie with a
big (for me) problem.

I'm using gcc 1.1.2 realease on a ReadHat Linux 6.2, Intel PC.

Function Getch() stops the execution of the program till the user press a
key. On other platforms/compilers this function do not wait for the
keypress.

I know Getch() is not standard, but I want to ask You if someone knows
another way to do what I need, with gcc/Linux.

Another question: is there any function I can use to put a character in the
keyboard buffer ?

Please, help me.
Thankyou in advantage.

Davide Guolo
Programma Computer

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Getch() waits for a keypress...
  2001-04-24  7:16 Getch() waits for a keypress Programma Computer
@ 2001-04-24  7:27 ` Alexandre Oliva
  0 siblings, 0 replies; 6+ messages in thread
From: Alexandre Oliva @ 2001-04-24  7:27 UTC (permalink / raw)
  To: Programma Computer; +Cc: gcc, support

On Apr 24, 2001, "Programma Computer" <programma@tin.it> wrote:

> Function Getch() stops the execution of the program till the user press a
> key. On other platforms/compilers this function do not wait for the
> keypress.

You can always reopen stdin in O_NONBLOCK mode.

> Another question: is there any function I can use to put a character
> in the keyboard buffer ?

Nope.  The keyboard buffer is several layers of abstraction down
inside the kernel.  You may use ungetc() to push a character back into
stdin.

-- 
Alexandre Oliva   Enjoy Guarana', see http://www.ic.unicamp.br/~oliva/
Red Hat GCC Developer                  aoliva@{cygnus.com, redhat.com}
CS PhD student at IC-Unicamp        oliva@{lsd.ic.unicamp.br, gnu.org}
Free Software Evangelist    *Please* write to mailing lists, not to me

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Getch() waits for a keypress...
  2001-04-24  8:59 ` Philipp Thomas
@ 2001-04-24  9:52   ` Maurizio Umberto Puxeddu
  0 siblings, 0 replies; 6+ messages in thread
From: Maurizio Umberto Puxeddu @ 2001-04-24  9:52 UTC (permalink / raw)
  To: Programma Computer; +Cc: gcc

Linux C programming:

linuxCprogramming-subscribe@listbot.com

Linux C++ programming:
tuxCPProgramming-subscribe@listbot.com

Hope this helps,

Maurizio Umberto Puxeddu.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Getch() waits for a keypress...
  2001-04-24  7:49 Programma Computer
@ 2001-04-24  8:59 ` Philipp Thomas
  2001-04-24  9:52   ` Maurizio Umberto Puxeddu
  0 siblings, 1 reply; 6+ messages in thread
From: Philipp Thomas @ 2001-04-24  8:59 UTC (permalink / raw)
  To: Programma Computer; +Cc: gcc

* Programma Computer (programma@tin.it) [20010424 16:53]:

> I want to put it after the others. Can I do this ?
> Or, is there any way to know if a character is pending in the buffer before
> using getch() to retrieve it ?

For questions like these, that have nothing to do with the development of
gcc, please go to lists/newsgroups more appropriate. 

Philipp

-- 
Penguins shall save the dinosaurs
                          -- Handelsblatt about Linux on S/390

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Getch() waits for a keypress...
@ 2001-04-24  8:40 Mike Stump
  0 siblings, 0 replies; 6+ messages in thread
From: Mike Stump @ 2001-04-24  8:40 UTC (permalink / raw)
  To: gcc, programma

> From: "Programma Computer" <programma@tin.it>
> To: <gcc@gcc.gnu.org>
> Date: Tue, 24 Apr 2001 16:54:58 +0200

> >You can always reopen stdin in O_NONBLOCK mode.

> Have You any sample to give me ?. Please, be patient, I'm a newbie.

Actually, this list is for the discussion of how to program the
compiler, not how to use the compiler...  While we would love to be
able to discuss such things on this list, it would add about an order
of magnitude to the traffic on this list, and it is already very high.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Getch() waits for a keypress...
@ 2001-04-24  7:49 Programma Computer
  2001-04-24  8:59 ` Philipp Thomas
  0 siblings, 1 reply; 6+ messages in thread
From: Programma Computer @ 2001-04-24  7:49 UTC (permalink / raw)
  To: gcc

Alexander,

thankyou for the speedy reply.

>You can always reopen stdin in O_NONBLOCK mode.

Have You any sample to give me ?. Please, be patient, I'm a newbie.

>> Another question: is there any function I can use to put a character
>> in the keyboard buffer ?
>
>Nope. The keyboard buffer is several layers of abstraction down
>inside the kernel. You may use ungetc() to push a character back into
>stdin.

As far as I know, ungetc() will put the character before any other pending
in stdin.
I want to put it after the others. Can I do this ?
Or, is there any way to know if a character is pending in the buffer before
using getch() to retrieve it ?

Thankyou very, very much.
Davide.


^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2001-04-24  9:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-04-24  7:16 Getch() waits for a keypress Programma Computer
2001-04-24  7:27 ` Alexandre Oliva
2001-04-24  7:49 Programma Computer
2001-04-24  8:59 ` Philipp Thomas
2001-04-24  9:52   ` Maurizio Umberto Puxeddu
2001-04-24  8:40 Mike Stump

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).