[comp.lang.c] QIO read with timeout

a204@mindlink.UUCP (Alexander Stockdale) (06/13/90)

You probably should be using the IO$M_TIMED function modifier in your
QIO call.  I've found that using this modifier and supplying a value of
0 for theime (in parameter P3) works well.  If your input buffer is
only one character long, then this call will empty the type ahead buffer into
the input buffer until a termination condition occurs (i.e. buffer full).  The
net effect is a getchar type of operation.  I've spent a lot of time monkeying
around with QIO to simulate the operation of popular UNIX functions like
getchar(), and it can be a pain.  The best way to approach it is to read the
I/O User's manual, chapter 8 (the terminal driver), very carefully.  Even that
doesn't tell you everything (you can find some interesting and useful modifiers
by reading SYS$LIBRARY:iodef.h).  You don't say much about how your application
works, but you will probably want to check out the use of PASSALL.  I learned
about this from modifying the code to C-Kermit to work under VMS.   Anyway,
hope this helps.
--
------------------------------------------------------------------------
Alexander Stockdale  |   I'm not getting older -- I'm getting bitter.
Vancouver, BC, Canada|                      - me (as far as I know)

8099pierzina@vmsd.csd.mu.edu (Todd Pierzina) (06/14/90)

I need to do a read from the keyboard in VAX C with a very small timeout
value.  I am in a loop, and I want to check for a key being pressed (any
key), and if one is pressed, then terminate the repeat loop.  I'm looking
for something like the (MS-DOS, I believe) function kbhit().  Any ideas?
The program uses getch, but it's been rewritten to conform with Un*x's (oh,
I'm on VAX C, VMS 5.3-1).  It does a sys$assign to kb_chan on the first
call, then reads from that channel with a qio request.

Please reply to me directly, as I am not on this list.  As you can probably
tell, I am not a C programmer, either, just trying to get an application
ported from Un*x to VMS.  Of course, by the time I get this thing to work, I
just may be a C guru!

Thanks.

Todd Pierzina

Student Programmer
Marquette University
8099PIER@MUCSD                (BITNET)
8099pierzina@vmsd.csd.mu.edu  (Internet)