Mail Archives: djgpp/1998/07/16/20:09:06
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
- Raw text -