Date: Thu, 1 Sep 1994 09:26:50 +0500 From: ronis AT onsager DOT chem DOT mcgill DOT ca (David Ronis) To: djgpp AT sun DOT soe DOT clarkson DOT edu Subject: bug in scanf() There is a bug in scanf() in version 1.11.m5. The following code shows the problem: #include main() { while(1) { int i,j; j=scanf("%d",&i); printf("i=%d; j=%d\n",i,j); } } As long as the field scanned is a valid integer, things work as expected. However, if an invalid integer is entered, e.g., a character, scanf returns 0 and leaves i untouched (this is as expected). The problem is that on the next loop scanf no longer reads the console. It simply returns zero without reading any input. David Ronis