이 게시물은 스택 오버플로 이전에 작성된 것으로 알고 있으며 여러 자습서를 결합했습니다. 하지만이 코드가 실행시 오류를 일으키는 이유는 무엇입니까? 컴파일됩니다. 시간C++ 읽기 txt 파일 CSV 값
while (leaderBoardFile.good())
{
playerInfoVector.clear();
getline (leaderBoardFile,line);
의
void leaderBoard::loadFromFile(void)
{
string line;
ifstream leaderBoardFile ("leaderboard.data");
vector<string> playerInfoVector;
if (leaderBoardFile.is_open())
{
while (leaderBoardFile.good())
{
playerInfoVector.clear();
getline (leaderBoardFile,line);
std::string input = line;
std::istringstream ss(input);
std::string token;
//cout << line << endl;
while(getline(ss, token, ',')) {
//for current line;
playerInfoVector.push_back(token);
}
string firstName = playerInfoVector.at(0);
string stringAge = playerInfoVector.at(1);
string stringScore = playerInfoVector.at(2);
//int age;
//stringstream(stringAge) >> age;
//int score;
//stringstream(stringScore) >> score;
//addScore(firstName,age,score);
////stringstream(stringAge) >> age;
////Add text to vector (push back)
playerInfoVector.clear();
}
leaderBoardFile.close();
}
else cout << "Unable to open file";
}
무엇이 오류입니까? – jrd1
그리고 어떤 종류의 오류가 있습니까? – Sinkingpoint
"Labyrinth.exe에서 0x75BFC41F의 첫 번째 예외 : Microsoft C++ 예외 : 메모리 위치 0x003EF298의 std :: out_of_range." –