Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

write a kbhit() function using stdio

Status
Not open for further replies.

slowbob

Technical User
Dec 15, 2000
7
NL
How do I test for any key without stopping program flow?
c = getc(stdin); halts and waits for enter key.
I wan't to keep going until a key is hit.
windows app using nospace std
 
Hi,

You can solve the problem
by making the program a TSR
 
No nice try guys.
1) A TSR will not run on target machine.
2) CodeWarrior has only implemented
kbhit() for Mac not PC.:p


 
The next thought would be to call a BIOS or DOS keyboard interupt function. eg: call interupt 21h with AH = 0Bh and check the value of AL upon return. (AL = FFh if character available). Then you must read the character or the next call to the function will, and rightly so, tell you that there STILL is a character in the buffer.



Kim_Christensen@telus.net
 
Thanks,
I'll try this.
20 years of improvments and 'high level' languages
and we still have to solve problems in assembler!
Hope you had good Xmas.
'If its hard to write it should be hard to read'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top