Hi Zhiheng,
On 4/16/21 11:28 AM, Zhiheng Li wrote:
Hi Stefan
After doing some tests, I also found that the buffer was flushed out of
main. Thank you for telling me that.
Even if the following program can print "Hello, world!"(Just replace 100
with BUFSIZ in your example), it is illegal. Because buf is used outside
the scope of buf when fulshing.
#include <stdio.h>
int main(void)
{
char buf[BUFSIZ];
setbuf(stdout, buf);
printf("Hello, world!\n");
return 0;
}
So there is only a typo of 'stdout' in man pages. Could you fix it? Thanks.
Sure! Fixed. Thanks for the report :)
Cheers,
Alex
--
Alejandro Colomar
Linux man-pages comaintainer; https://www.kernel.org/doc/man-pages/
http://www.alejandro-colomar.es/