putc on unbuffered FILE
Jakub Jelinek
jakub@redhat.com
Sun Jul 2 22:43:00 GMT 2000
Hi!
#include <stdio.h>
int main(void)
{
putc('1', stderr);
putc('2', stderr);
}
does not work properly in glibc 2.1.91 ('2' is not printed at all).
Seems like '2' is just recorded into the write buffer in _IO_putc_unlocked
(glibc 2.1 does the same, I wonder though, is it right when the FILE is
unbuffered?), so most probably just exit optimizes and does not flush
unbuffered streams. fflush(stderr) after the last putc helps, BTW.
Jakub
More information about the Libc-hacker
mailing list