관련된 질문 중 하나에 사용 된 양식을 사용하고있었습니다. 문제는 내가 파일의 마지막에 계속 가고 있다는 것이다.C++ EOF Getline Error
파일은 fstream이며 str은 문자열입니다.
처리되지 않은 예외 마이크로 소프트 C++ 예외 : 표준 : : ios_base :: 실패
while (getline(file, str)) {}
if (cin.bad()) { // IO error } else if (!cin.eof()) { // format error (not possible with getline but possible with operator>>) } else { // format error (not possible with getline but possible with operator>>) // or end of file (can't make the difference) }
덕분에, 파일을 여는 예외 예제 코드의 일부는, raw_data.exceptions을 한 것으로 통보하지 않았다 (ifstream :: failbit | ifstream :: badbit); – Roo