Subject: | |
From: | |
Reply To: | |
Date: | Sat, 5 Jun 1999 09:29:52 -0700 |
Content-Type: | text/plain |
Parts/Attachments: |
|
|
It's been over a dozen years since I wrote 3GL (Fortran66) code for
controlling character-mode (vs. block-mode) data entry, but I seem to recall
that reads (FREAD?) could be limited by the number of characters rather than
a time-out. If this is correct, you could issue 1-byte reads and process
each character as it came in.
If my memory is faulty, please let this reply die in peace ;-) If not, I'll
leave it to others to supply sample COBOL code for accomplishing the above.
I'll also let someone else chime in on pros and cons of buffering the input
in a gaming situation. (How long does it take to refresh the screen after
each input? If I'm mashing keys based on a screen that is 5 inputs "out of
date", I might be moving in the wrong direction or otherwise negatively
effecting my chances of winning :-) If you don't want to buffer the input,
(a) DON'T allow typeahead, and (b) issue the 1-byte FREAD when you're ready
for input (AFTER any processing and screen-refreshing from the previous
FREAD). Any keys pressed before the FREAD are lost (I think).
That said, if you DO want to buffer input, I like Stan's approach #3. (Just
change "(possibly with a timeout)" to "(1-byte FREAD)". This opens up many
other possibilities as what you are really doing is setting up client-server
processing. It just happens that both the client and the server are HP3K
COBOL processes. If properly constructed, the client could be ported to a
different platform ... but that's another thread.
--Brent Flowers
Mark Gallaher <[log in to unmask]> wrote in message
news:7j8l97$789$1@ash.prod.itd.earthlink.net...
> Hello!
>
> I'm writing a text-adventure in Cobol on a 3k. What I need to do is
> something like BASIC's INKEY function; I want to check if any keyboard
input
> has happened and possibly do other processing.
[... snip ...]
|
|
|