Keyboard Strokes w/o Delay...


 
Thread Tools Search this Thread
Top Forums Programming Keyboard Strokes w/o Delay...
# 1  
Old 10-03-2001
Keyboard Strokes w/o Delay...

Hello(again), but I was wondering how you would obtain a keyboard stroke from a user with no delay(they don't have to hit enter) and then place that stroke into a variable?

Lets say you tell the user to hit, on the numpad, a number. Then that number is placed into a variable w/o the user hitting enter to confirm. I tried fooling around with getch(), but I don't know how to then have that number placed into a variable. Any info will be greatly appreciated, thanks!

Mike
# 2  
Old 10-03-2001
I'm not sure if this is what you're asking but...

main()
{
int c;

....
....
....
c = getch();
printf("%c", (char)c);
....
....
}


Obviously, you would want to do this in a loop but
use caution as this, (assuming NO_DELAY) in a tight loop will
consume lost of CPU doing nothing. Again, I'm not exactly
clear on your objective.
# 3  
Old 10-03-2001
MySQL Perfect!

This is exactly what I needed to know, thank you once again rwb!

Mike
Login or Register to Ask a Question

Previous Thread | Next Thread

7 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Trying to understand the delay

Heyas As you know me, i have scripts for about almost every aspect of my IT life. This time, i'm having issues to figure out why my script to connect to my wifi spots takes so long when started as service. The service file (the after:local-fs.target is for 'home installations'): cat... (3 Replies)
Discussion started by: sea
3 Replies

2. UNIX for Dummies Questions & Answers

Delay with Wget

I have a list of URLs that I need to download in a file. I know I can use the -i option to load the URLs from the file, but how can I make Wget wait a couple secs between each URL download? (4 Replies)
Discussion started by: rlopes
4 Replies

3. UNIX for Dummies Questions & Answers

Problem getting vertical bar with British keyboard layout on US (physical) keyboard

Hi, I've got a bit of a ridiculous problem and wasn't sure where to post it. I need to use the vertical bar for piping in Bash but, as per the title, am using a UK layout on a US (physical) keyboard which doesn't have a key for it in the place I'd expect. I've tried using xbindkeys and Unicode... (7 Replies)
Discussion started by: crunchgargoyle
7 Replies

4. Shell Programming and Scripting

Capturing key strokes

I have a shell script and i want to capture the key strokes in that script while that script is in running state. For example During the running of the process , if i press CTRL+Z i need to capture those key strokes in that script. Any idea pls. Regards, ORK (3 Replies)
Discussion started by: Ravi oruganti
3 Replies

5. Shell Programming and Scripting

while loop and delay

Dear all, if we want to run a command every 5 mins to check if the process is working fine or not... like in c, we can use a simple while loop with a delay for 5 mins... how can we accomplish this is solaris 8/9 thanks br/asad (5 Replies)
Discussion started by: asadlone
5 Replies

6. UNIX for Advanced & Expert Users

How can I map Unix keyboard for PC keyboard

A Solaris AXI 440 machine with Solaris 8 version. I have PC users who use an emulation to login to the Solaris server. How can I change the keyboard mapping of the Sun keyboard to fit to the PC keyboard ? Any comment will be appreciated. Thanks (1 Reply)
Discussion started by: simhab
1 Replies

7. UNIX for Dummies Questions & Answers

Delay in mv

Working on AIX 4.3 I have an active exe that accepts files for processing on our RS6000. Day to day i store these files in a secure place and at the end of the day I mv them one by one. After some reading and ofcourse trial and error i figured out that this helps... mv `ls -l |head -l | awk... (2 Replies)
Discussion started by: buRst
2 Replies
Login or Register to Ask a Question