From: tzuo AT magi DOT com (Tao Zuo) Subject: scanf does not return EOF? 11 Feb 1997 18:43:28 -0800 Approved: cygnus DOT gnu-win32 AT cygnus DOT com Distribution: cygnus Message-ID: <3300EBEE.10203FED.cygnus.gnu-win32@magi.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Mailer: Mozilla 3.01 (X11; I; Linux 2.0.12 i586) Original-To: gnu-win32 AT cygnus DOT com Original-Sender: owner-gnu-win32 AT cygnus DOT com Hi, Does anyone encounter this: Upon end-of-file scanf seems return 0 instead of EOF (which is -1 in gcc). The following is a simple test, your comments is appreciated. #include main() { int i; int end=0; int state, rectype, persons, hhtype; while(!end) { if ((i = scanf(" %d %d %d %d\n", &rectype, &state, &persons, &hhtype)) == EOF) { printf("end of line reached\n"); printf("%d\n",i); end=1; } else { printf("readin one line\n"); printf("%d %d\n",i, EOF); } } } Input is this: 1 2 3 4 2 4 5 6 These are the steps: gcc junk.c a.exe