stdout - Setting C program to line buffer won't work -



stdout - Setting C program to line buffer won't work -

i'm trying forcefulness c programme line buffer (stdout going captured java program), seems buffer instead. here sample code:

#include <stdio.h> #include <stdlib.h> int main(){ char c; setvbuf(stdout, null, _iolbf, bufsiz); printf("hello world\n"); c = getchar(); printf("got char: %c\n", c); }

if specify _iolbf or _iofbf, don't see output until input char. if utilize _ionbf see output before getchar(). shouldn't _iolbf same since "hello world\n" contains '\n'?

i using visual c++ 2005.

thanks

according this microsoft documentation:

_iolbf: systems, provides line buffering. however, win32, behavior same _iofbf - total buffering.

c stdout buffering

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

c# - Can ProtoBuf-Net deserialize to a flat class? -

javascript - Change element in each JQuery tab to dynamically generated colors -