テキストファイルの最初の行だけを読み取り、その番号を int 変数に入力するプログラムを作成しようとしています。しかし、私はそれを行う方法について混乱しています。
int highscore; // Starting highscore
ifstream myfile ("highscore.txt");
if (myfile.is_open())
{
while ( myfile.good() )
{
getline(myfile,highscore);
cout << highscore << endl;
}
myfile.close();
}
しかし、何らかの理由でエラーが発生します。|25|error: no matching function for call to 'getline(std::ifstream&, int&)'|