[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: controlling stdio buffering
From: |
Pádraig Brady |
Subject: |
Re: controlling stdio buffering |
Date: |
Wed, 22 Mar 2006 09:42:52 +0000 |
User-agent: |
Mozilla Thunderbird 1.0.7 (X11/20051013) |
Andreas Schwab wrote:
>Pádraig Brady <address@hidden> writes:
>
>
>
>>p. p.s. Note glibc changes the buffering automatically for stdout only like:
>> if (isatty(fileno(stdout)) setlinebuf(stdout)
>>Also it always leaves stdin buffered and stdout unbuffered.
>>
>>
> ^^^^^^
>stderr
>
>
yep, thanks.
>
>
>>p.p.s. setvbuf(stdin, (char*) NULL, _IOFBF, 12345) is not honoured,
>>which is fair enough as buf==NULL.
>>However 0 is returned indicating it was honoured?
>>
>>
>
>What do you mean with "not honoured"? The size may be ignored when buf is
>NULL.
>
>
>From the man page:
"The function setvbuf returns 0 on success. It can return any value on
failure, but returns nonzero when mode is invalid or the request cannot
be honoured. It may set errno on failure. The other functions are
void."
It's just that above call seems to have no affect,
i.e. it's probably a programmer error to call with (buf==NULL && size!=0)?
Therefore I would not expect it to return 0 (success).
thanks,
Pádraig.