From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 1164f8,ad10cb6ba8193de1,start X-Google-Attributes: gid1164f8,public X-Google-ArrivalTime: 1992-04-08 13:23:10 PST Newsgroups: comp.sys.dec Path: sparky!uunet!zaphod.mps.ohio-state.edu!moe.ksu.ksu.edu!unlinfo.unl.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.202310.11007@news.unomaha.edu> Sender: news@news.unomaha.edu (UNO Network News Server) Organization: University of Nebraska at Omaha Date: Wed, 8 Apr 1992 20:23:10 GMT X-News-Reader: VMS NEWS 1.11 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 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 */ 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)