Subject: | |
From: | |
Reply To: | |
Date: | Tue, 16 Jan 2001 10:31:43 -0600 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
Hello,
I have started doing some programming on the MPE using
C language and found that I cannot write a program in C
to capture a single keypress from the user. The user is
using Reflection from WinNT to login to the Hp3K. I
wrote a program that prompts the user for Yes or No
and when the user press Y, rightaway the program
responds with a result ... but what happen is that the
user has to press Y and then press ENTER key. I
do not want the user to press ENTER key, just
press Y and the program takes the keypress and
processes on.
I emailed HP3K Anwerline and they suggested that I
use the FREAD to the terminal to accomplish this. But
being a novice programmer myself, I am unable to
do this although I have tried reading many PDFs on
this FREAD and FOPEN. I dunno how to FOPEN
the STDIN and then FREAD a character and then
pass control to the program.
Could someone kindly help me with a simple script
or program to illustrate how I can do this. I appreciate
very much your help.
The program I have is as follows (where I have
to press a ENTER after pressing Y) :
main()
{
char c[1];
printf("Do you want to continue (Y/N) ?");
c = getchar();
if strcmp(c,"Y")
printf("Continue")
else
printf("End");
}
|
|
|