我正在嘗試讀取csv文件並將其存儲在C++的HashMap中。這是我的代碼。在C++中將csv讀入unordered_map
void processList(std::string path, std::unordered_map<std::string, int> rooms){
std::ifstream openFile(path);
std::string key;
int value;
std::getline(openFile, key, ','); //to overwrite the value of the first line
while(true)
{
if (!std::getline(openFile, key, ',')) break;
std::getline(openFile, value, '\n');
rooms[key] = value;
std::cout << key << ":" << value << std::endl;
}
}
我不斷收到以下錯誤
error: no matching function for call to 'getline'
std::getline(openFile, value, '\n');
我在做什麼錯。