Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ukma!uflorida!winnie!zach!acs60222 From: acs60222@zach.fit.edu ( ENRIQUEZ) Newsgroups: comp.lang.c Subject: Input Problem Message-ID: <553@winnie.fit.edu> Date: 4 Aug 89 17:55:35 GMT Sender: usenet@winnie.fit.edu Reply-To: acs60222@zach.UUCP ( ENRIQUEZ) Organization: Florida Institute of Technology, ACS, Melbourne, FL Lines: 27 I am attempting to get single character input for a menu function. My problem is that the '\n' character ALWAYS gets put into the buffer (?), so that if the input character is not valid, funny things happen... Is there a easy way to "strip" the undesired character from the getchar() fuction. Program example: char foobar_menu (); { char choice; do { printf (" ....menu stuff...."); printf ("Command: ); choice = getchar(); } while (choice !valid); return (choice); } This works fine if choice is valid. However, if choice not valid, the menu is printed twice. While I can live with this, I would rather not. Any help will be appreciated... mark enriquez acs60222@zach.UUCP