Skip to content

Instantly share code, notes, and snippets.

@mrPjer
mrPjer / content.md
Last active August 29, 2015 14:18
Why won't my program output when redirected to a file?

The problem

  • Output not being output when redirecting output to a file

The cause

  • When stdout points to a file, it gets buffered by libc into a 4k buffer
  • Terminal output is line buffered, stderr is always unbuffered

The fix