Thread View: comp.os.msdos.programmer
1 messages
1 total messages
Started by c/o Peter Gaal
Fri, 17 Aug 1990 09:39
reading stdin one character at the time
Author: c/o Peter Gaal
Date: Fri, 17 Aug 1990 09:39
Date: Fri, 17 Aug 1990 09:39
33 lines
1560 bytes
1560 bytes
HiHo!
I hope someone may help me with the following problem:
Asume this C fragment:
int dev_ready(int handle)
/* does an ioctl() call on handle to get an input-ready status
* This should work, assume it does.
*/
{ some code... }
...
setraw(fileno(stdin));
while (!dev_ready(fileno(stdin)) { /* do something 'til a key is hit */ }
c=fgetc(stdin); /* read ONE character */
The task is: query if a character is present on some handle, if not, do
something else, and if it is, read exactly this character.
The Problem is the function setraw() above, which should set a CON: device
(normally associated with stdin) into a raw mode.
All experiments 'til now failed to force the CON: device to read the
keyboard one character at the time - it allways reads a complete line
which breaks the nonblocking intention of the above.
Important: I do not want code reading the keyboard directly (via BIOS or so),
I need the possibility to continue working with the handle only.
Please E-Mail suggestions, and only post code if it's tested...
Thanx in advance
Patrick
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads