Message-ID: <3B5DAECE.69DE4BF5@crbkpc.com> Date: Tue, 24 Jul 2001 13:22:23 -0400 From: Chris Smith X-Mailer: Mozilla 4.7 [en] (Win98; U) X-Accept-Language: en MIME-Version: 1.0 To: djgpp AT delorie DOT com Subject: cin.sync() & blue screen Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com Two questions: 1.) I'm using the function below in my program to get input from the user. Everything compiles ok, but if the user enters a char instead of int, or any other invalid input, the program goes into an infinite loop. Presumably, this is because cin.sync() is not flushing the standard input buffer. 2.) Also, if the user attempts to exit the program by clicking on the close window button on the upper righthand corner of the MS DOS window (instead of entering data), the program crashes with the blue-screen of death. Any insight into what I'm doing wrong would be greatly appreciated. // function to retrieve the input from the user void getnumber(char sentence[], int* input){ cout<>*input)){ cin.sync(); cin.clear(); cerr<<"Invalid Input"<