[ back to toc ]

getch() function

Date: 2002/03/23 18:53

Q:
Can you tell me if the getch() function is standard C? I know most
compilers include it in header files like conio.h, but is it a standard
function? I want to get the same effect as using getch(), but getchar()
does not work in the same way. It only returns a character after Enter
has been pressed. Is it possible to change how the buffering works to
force getchar() to work in a similar way to getch()? Any help would be
great.

*NAME-DELETED*
A:
getch() is Windows specific, not standard. Why do you want to use
getchar() if there is getch() already implemented?

regards,
Peter
Q:
I want to create a menu system to use in DOS, but I need a getch() type
function rather than getchar() so the user doesn't have to press Enter
after every seletion. Would it be possible to change how the buffering
works in the program to force getchar() to work like this?

*NAME-DELETED*

A:
If you need this program to work on DOS then use getch() and do not worry
about the portability.

Peter

[ back to toc ]