snprintf() forces the line to be NULL-terminated; no need for an extra \n