You're inconsistent about using puts/fputs versus printf/fprintf. I'd prefer you pick one and stick with it.