It is currently Mon, 28 Jul 2014 05:19:49 GMT



 
Author Message
 Getch?
Hi, in Borland C++ there is a function called getch() in ctype.h.  How do you
use that function or similar function in the UNIX system?  Thanks!!!


 Sun, 23 Dec 2001 03:00:00 GMT   
 Getch?
On 07 Jul 1999 19:07:50 GMT, Zeos7 <ze...@aol.com> wrote:

That's a freakin' weird place to put an input function.

If all you want is a "press any key to continue" then you
can play with tty mode settings directly (man tcsetattr,
and follow up with the "see also"s), fudge it a little:
  system("/sbin/stty cbreak"); c=getchar(); system("/sbin/stty -cbreak");
You can also change your mind and make that a "press ENTER to continue",
or you can use the next suggestion.

Often when you want to have single-character input like this
you're also interested in having control over the screen,
and so you may want to look into the curses library.  In
this case, after you've initialized curses, you'll have
a function named (strangely enough) getch() which will
read in one keystroke.

                --Ken Pizzini



 Sun, 23 Dec 2001 03:00:00 GMT   
 
   [ 2 post ] 

Similar Threads

1. G++, getch()

2. How do I do getch() or getchar() without pressing Enter

3. getch /getchar / getc

4. getch /getc/getchar

5. G++, getch()

6. ncurses : getch() does not work without echo

7. GCC/NCURSES/GETCH

8. How to use getch() on UNIX ??

9. if ( getch () || poll() )

10. getch.. without curses


 
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software