use fgets() rather than getline()