c++ getline reads entire file
问题 I'm using std::getline() to read from a text file, line by line. However, the first call to getline is reading in the entire file! I've also tried specifying the delimeter as '\n' explicitly. Any ideas why this might be happening? My code: std::ifstream serialIn; ... serialIn.open(argv[3]); ... std::string tmpStr; std::getline(serialIn, tmpStr, '\n'); // All 570 lines in the file is in tmpStr! ... std::string serialLine; std::getline(serialIn, serialLine); // serialLine == "" here I am using