Bug#1986: stdio broken? Strange behaviour of fgets() and scanf()

1995-12-07 Thread Stephen Early
> Maybe that's it. Maybe 'fgets' is interfering with how scanf works. > Does it still fail if you remove the 'fgets' from the for loop? Yes, it still fails. I tried removing the #define from the start of the string to be matched, though, and it no longer fails. OTOH, the original program (which i

Bug#1986: stdio broken? Strange behaviour of fgets() and scanf()

1995-12-07 Thread Stephen Early
On Thu, 7 Dec 1995, brian (b.c.) white wrote: > > for (ksnum=0; 1; c=fgets(buf,sizeof(buf),stdin)) { > > The third thing in the "for" structure only gets executed at end of > the loop. 'c' thus has an undefined value on the first iteration > which just happened to be NULL for you (hence the "(ni

Bug#1986: stdio broken? Strange behaviour of fgets() and scanf()

1995-12-06 Thread Stephen Early
Package: libc5 Version: 5.2.16-1 (My libc5-dev version is also 5.2.16-1) The following program (which is similar in structure to one of the programs used in building xlib) loops forever when it reaches EOF on stdin: #include int main(int argc, char **argv) { int ksnum,i; char buf[1024];