use read instead of getline