Replace printf in hot path with equivalent fwrite

This is very slightly faster.