Zig NEWS

Discussion on: How to Add Buffering to a Reader / Writer in Zig

Collapse
 
user673679 profile image
user673679

Isn't stdout usually line buffered (or fully buffered). Does zig do something to turn this buffering off, or do we now have two sets of buffering? If so, how does one flush the underlying stream?

Collapse
 
jlombera profile image
jlombera • Edited

That buffering is done by libc not the OS. So no buffering if you write directly to stdout's OS file descriptor. In C, you'll observe the buffered IO if you use printf(3)/fprintf(3)/fwrite(3), but not if you used write(2) directly.