This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

putc on unbuffered FILE


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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]