Help getch problems

Help getch problems

Post by Paul Bla » Tue, 31 Oct 1995 04:00:00



I have a problem with the getch function under linux.
If i use a statement like:

c = getch();

I would the screen to wait for the next user keypress and return
the value of it in c. What seems to happen under Linux is that
the user has to hit the key and then hit enter to continue.

Can alyone tell me what the workaround on this problem is
and why I am having this type of problem.

Thanks...   Paul

 
 
 

Help getch problems

Post by Hiro Sugawa » Wed, 01 Nov 1995 04:00:00


Does anybody know where the executable and man page of gperf are?
I could find source code but GCC 2.6.3 cannot compile it due to somthing
in netsted class definitions.

Thanks in advance.
hiro
--

Oracle Corporation                           MPP Development
500 Oracle Parkway, Box 659107, Redwood Shores, CA 94065 USA

 
 
 

Help getch problems

Post by Dimitri Maziu » Thu, 02 Nov 1995 04:00:00



> I have a problem with the getch function under linux.

Getch() is not ANSI C.

Quote:> If i use a statement like:

> c = getch();

> I would the screen to wait for the next user keypress and return
> the value of it in c. What seems to happen under Linux is that
> the user has to hit the key and then hit enter to continue.

> Can alyone tell me what the workaround on this problem is
> and why I am having this type of problem.

> Thanks...   Paul

Try 'man getch', in particular look for "cbreak" settings.

--
Dimitri
----------------------------------------------------------------------------
Imagine an opaque closed box containing a cat and a vial of poisonous gas.  
At any given moment the cat may break the vial and die of poisining.  Since
we cannot tell, without opening the box, whether the cat is dead or alive
at a given moment, we access the cat's state in terms of probabilities; say,
50/50.  So, the cat is 0.5 dead and 0.5 alive.  Let me rephrase that: at any
given moment the cat is both dead _and_ alive.
Such cat is called the Shroedinger's cat.

 
 
 

Help getch problems

Post by Andreas Schw » Fri, 03 Nov 1995 04:00:00


|> Does anybody know where the executable and man page of gperf are?
|> I could find source code but GCC 2.6.3 cannot compile it due to somthing
|> in netsted class definitions.

You could also try cperf which is the same as gperf but written in C.
--
Andreas Schwab                                      "And now for something

 
 
 

Help getch problems

Post by Koyama Tadayos » Mon, 06 Nov 1995 04:00:00


        cbreak()
--


 
 
 

Help getch problems

Post by Joseph I. Valenzue » Fri, 17 Nov 1995 04:00:00


:       cbreak()
: --


Wouldn't it be possible to do something along the lines of
fread(&c,1,1,stdin)?

--

"One day an egg, a snake, a centipede, an ant, and a piece of
dung set out on a head-hunting expedition..." - Roland Dixon

 
 
 

Help getch problems

Post by Zeyd M. Ben-Hal » Sat, 18 Nov 1995 04:00:00





>:   cbreak()
>: --


>Wouldn't it be possible to do something along the lines of
>fread(&c,1,1,stdin)?

Nope! It will return one character but it will still wait for
newline!

Zeyd
--
---

NCURSES is available from ftp.netcom.com:pub/zm/zmbenhal/ncurses
Current version is 1.9.7

 
 
 

Help getch problems

Post by Koyama Tadayos » Mon, 20 Nov 1995 04:00:00



Quote:>[Deleted]
>   >Wouldn't it be possible to do something along the lines of
>   >fread(&c,1,1,stdin)?

>   Nope! It will return one character but it will still wait for
>   newline!

I test this with a small program below:

/* program a.out*/
#include <stdio.h>
main()
{
  char c;
  if (isatty(1)) cbreak();
  for (;;) {
    if (fread(&c,1,1,stdin)) {
      if (c == '$')
        break;
      putchar(c);
    }
  }
  if (isatty(1)) nocbreak();

Quote:}

when stdin is a tty , fread() does not wait for NOTHING, just returns
zero if there are no input.

cat - | ./a.out does wait for newlines, but what which waits is 'cat',
not this program. this time, though, fread wait for one character,
rather than just returns with 0.

--


 
 
 

1. I need a getch() - Any help?

Hi, I'm programming in DOS, but I need to run my program on the school UNIX
system.  I am using the gcc compiler.

Anyway, the UNIX system doesn't have conio.h, which has the getch() function
that I use in DOS to pause the program until the user presses a key.

Is there any SIMPLE, easy, QUICK, already-made, function in UNIX that will
do this for me?  Someone mentioned curses.h will have getch(), but I'm
getting errors involving stdscr, and wgetch... I really don't get it.
Frankly, I am not familiar with UNIX, and I am definately slow at getting
around the text-based OS.

Thanks for any help.

2. Mouse Problem!

3. curses getch help

4. RPM's

5. HELP ON GETCH

6. Cannot do mlockall? (cdrecord)

7. Help with getch()

8. Problem with FTP (ls)

9. getch problem

10. Problems using getch

11. problems with getch()

12. getch() problem

13. Curses: problem with getch while keypad is set