Sender: nate AT cartsys DOT com Message-ID: <35AAF20E.FA3193F9@cartsys.com> Date: Mon, 13 Jul 1998 22:52:14 -0700 From: Nate Eldredge MIME-Version: 1.0 To: "John M. Aldrich" CC: djgpp AT delorie DOT com, "David P. Hack" Subject: Re: Buffered input References: <6_Ap1.22$s7 DOT 1149262 AT alpha DOT sky DOT net> <6o79as$913$1 AT slave1 DOT aa DOT net> <35A7E6DA DOT EA2C4522 AT cs DOT com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Precedence: bulk John M. Aldrich wrote: > > Roger W. Huggins wrote: > > > > David, you are quite right. There is a bug in DJGPP as compared to > > Borland's scanf function. I don't really know how to cure the problem > > except for not using scanf. I personally do not use scanf as it is too > > limiting . I would suggest using getch or getche depending on whether or > > not you want the entered chartered echoed to the screen. > > It's not a bug; Borland uses a highly nonstandard fflush() that somehow > manages to work on input streams. According to the ANSI standard, > flushing an input stream is an undefined operation. Given that it's undefined, perhaps this patch would be appropriate. *** src/libc/ansi/stdio/fflush.c~ Sun Jun 28 23:36:20 1998 --- src/libc/ansi/stdio/fflush.c Mon Jul 13 22:48:34 1998 *************** *** 29,34 **** --- 29,37 ---- return 0; } + if (f->_flag & _IOREAD) + for (;;) printf("Read the ANSI standard, Borland luser!\n"); + f->_flag &= ~_IOUNGETC; if ((f->_flag&(_IONBF|_IOWRT))==_IOWRT && (base = f->_base) != NULL :)) -- Nate Eldredge nate AT cartsys DOT com