0

i would like to know the way we can make user enter a number in a menu reply perhaps so that he doesnt have to press the enter key...........i.e. the program automatically proceeds with the give value and doesnt wait for an enter key to be pressed. its easy in foxpro but i dont know the way to do it in C.

4
Contributors
3
Replies
4
Views
7 Years
Discussion Span
Last Post by Tom Gunn
-1

i would like to know the way we can make user enter a number in a menu reply perhaps so that he doesnt have to press the enter key...........i.e. the program automatically proceeds with the give value and doesnt wait for an enter key to be pressed. its easy in foxpro but i dont know the way to do it in C.

use getch()

1

use getch()

Just be wary that the getch() function and the associated conio.h header file are not portable.

1

i would like to know the way we can make user enter a number in a menu reply perhaps so that he doesnt have to press the enter key

For this question we need to know what compiler and OS you use because there are no portable answers that will work everywhere. The answer needs to be tailored to your setup.

Just be wary that the getch() function and the associated conio.h header file are not portable.

This caveat applies to every solution because the problem itself is not portable. There is no standard way in C to read input without the possibility of buffering at a higher level. It is a system dependency.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.