Message-ID: <39298E3C.99DCB2A1@mail.owc.net> Date: Mon, 22 May 2000 14:45:00 -0500 From: 2711 X-Mailer: Mozilla 4.5 [en] (Win95; I) X-Accept-Language: en MIME-Version: 1.0 To: djgpp AT delorie DOT com Subject: Getchar problems in while() loop. Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Reply-To: djgpp AT delorie DOT com Hey, thank you for reading my message, I'm having problems with a little educational program I wrote, The magic number is obviously five, but when it is entered, like any other value, guess the magic number *beeep* guess the magic number *beeep* is displayed. #include void main(void) { int stop; while ((stop=getchar())!= 5) { printf("Guess the magic number\n\a"); stop=getchar(); } } I tried using two variables, one a char;, and atoi, but the the same results were encoutered. I also tried removig all references pertaining to "getchar", declaring the while loop "while(stop !=5)", and using "scanf" in the body of the loop, but to no avail. Is this a bug (?) or am I a moron (most likely)? Thank you much for your time ---dave