What Happened to bioskey?

T

tycho1546

Years ago I wrote some programs in Borland's Turbo C 2.0 that use a
library routine called bioskey(), which tests whether a keystroke is
available to be read. The bioskey() routine returns the proper
indication and allows the program thread to continue. (Other
routines, such as getch(), stop and wait for the user to enter one
or more keystrokes before allowing the program thread to continue.)

I am now recompiling this software using Borland C/C++ 5.0, and it
has no bioskey() capability. Turbo C 2.0 compiles under Real Mode
(or Virtual Real Mode), and Borland C/C++ compiles under Protected
Mode.

Likewise, my Turbo C 2.0 program uses library routines called
outportb() and inportb(). These send and receive data to/from a
hardware port over the ISA data bus. As above, these functions run
in Real Mode, and so I cannot use them when compiling with Borland
C/C++ 5.0 in Protected Mode.

Does anyone know how I can emulate the bioskey() and outportb()
functions when compiling under Borland C/C++ 5.0 in Protected Mode?
 
C

Chris Croughton

Does anyone know how I can emulate the bioskey() and outportb()
functions when compiling under Borland C/C++ 5.0 in Protected Mode?

Try asking in a Borland forum (see their website for details). I
suspect that getting keys from the BIOS is not supported now. Changing
ports may be completely blocked by the OS unless you are writing a
driver of other OS-level code.

It's certainly not portable C, there is no way in standard C to get
'keystrokes', only characters (and no way to test whether a character is
available without trying to read it, which blocks until a character is
available -- or a complete line or buffer depending on the buffering
mode). Various operating systems have ways to do it, but they are often
incompatible and need to be specified for the particular OS (and often
compiler).

Chris C
 
G

GMM50

Microsoft has a kbhit() function that returns true when a key has been
read.

Since I'm in love with Borland's products and they have lost the kbhit
function;
I wrote a dll in Visual C++ and made it a library that I include in my
Borland BuilderX builds.

Works great and it's a good exercize in extractinf features form one
tool set to another.

george
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,773
Messages
2,569,594
Members
45,114
Latest member
GlucoPremiumReview
Top