From: CONSLT24@Zeus.unomaha.edu (Issa El-Hazin)
Subject: Need to know how to fflush(stdin) in VMS C.
Date: Wed, 8 Apr 1992 20:23:10 GMT [thread overview]
Message-ID: <1992Apr8.202310.11007@news.unomaha.edu> (raw)
Does anybody know how to flush the stdin in VMS 'C'? I'm using the system();
function to run a command and would like to flush any key(s) the user might
press while waiting for the command to complete (esp. since the system(); call
takes a long time to spawn and run if there are too many people on the system
(Is there a faster alternative to using the system() call? I'm using VMS 5.4.3)
Also if anybody knows how to disable the Ctrl-Y from within a 'C' program I
would be greatly appreciative. I'm modifying a VMS menu program (5000 lines)
that I've wrote and if anybody is interested in running it they can do so by
telneting to zeus.unomaha.edu and login as a guest then typing "window" at
the $. The program is located in perm$5:[conslt24.public]. Please feel free
to use or to get a copy of it. Back to my question I'm doing something similar
to the next program and I can't figure out why it's not working.
#include <stdio.h>
main()
{
char test;
int array[10];
printf("\n Type a letter: ");
scanf("%c",&test); /* wait until I'm ready */
sleep(5); /* while waiting for 5 seconds */
/* Type a string and press <enter> */
fflush(stdin); /* flush standard input (keyboard) */
scanf("%s",&array); /* read what's in the input buffer */
printf("\n%s",array); /* will print the string typed before */
/* flushing the stdin */
}
Any suggestions are welcomed and are greatly appreciated.
Thanks in advance
/-Issa-/
(P.S. I'm not using scanf() to read the input, instead I'm using a function
called keypress() which will grap a char pressed without having to press
the enter key (arrow keys, F? keys ..), but I've tried the above program
both ways and it still don't work. I know RMS has its own buffers but
I can't find an example on how to do my requested task. fflush is
returning a '0' which indicates that the operation is successful)
reply other threads:[~1992-04-08 20:23 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
read-only archive
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox