Article View: comp.std.c
Article #186Need to know how to fflush(stdin) in VMS C?
From: Issa El-Hazin
Date: Wed, 08 Apr 1992 03:10
Date: Wed, 08 Apr 1992 03:10
42 lines
1954 bytes
1954 bytes
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 and Ctrl-Z 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-/
Technical Details
Message-ID:
<1992Apr8.031058.5525@news.unomaha.edu>Path:
arc1-ca.pugleaf.net!sparky!uunet!usc!sol.ctr.columbia.edu!news.unomaha.edu!newsShow Full Headers
Complete Article Headers
Newsgroups: comp.std.c Path: arc1-ca.pugleaf.net!sparky!uunet!usc!sol.ctr.columbia.edu!news.unomaha.edu!news From: CONSLT24@Zeus.unomaha.edu (Issa El-Hazin) Subject: Need to know how to fflush(stdin) in VMS C? Message-ID: <1992Apr8.031058.5525@news.unomaha.edu> Sender: news@news.unomaha.edu (UNO Network News Server) Organization: University of Nebraska at Omaha Date: Wed, 8 Apr 1992 03:10:58 GMT X-News-Reader: VMS NEWS 1.11 Lines: 42