Are you fputc'ing the EOF?