#: 11778 S3/Languages
14-Aug-91 18:57:47
Sb: #11777-#inkey
Fm: Bruce MacKenzie 71725,376
To: PHIL SCHERER 71211,2545 (X)
Oh, I thought you didn't want your inkey to hang up if no key had been pressed.
If you want it to stop and wait for the next keypress then your original
function should work adequately. Very often I need to check for a keypress and
if no key is pressed continue with some action. In such a case having the
program hang in the inkey can cause problems.
So really, whats still troubling you is that printf() doesn't imediately output
your string to the screen. Again, this is because all the standard library I/O
functions are buffered. What this means is that rather than outputing the data
imediately to the device driver the functions store the data in memory first.
They wait until the buffer is full or until a charage return occurs in the data
stream and then dump the data to the device driver in one block. If you want
your data to go to the screen before the inkey you can force C to dump all the
data in the file buffer to the output device by giving a fflush() command.
There is 1 Reply.
|