allocated null char, and s/puts/fprintf