我試圖製作一款可以保存進度的遊戲。 我已經做到了這一點,它的工作,但現在它不再工作。'authlog = myfile'中'operator ='的模糊超載
錯誤:
43: Ambiguous overload for 'operator=' in 'authlog = myfile'
note: candidates are: std::basic_string<_CharT,_Traits,_Alloc>& std::basic_string<_CharT,Traits,..........etc
,導致該錯誤代碼:
if (myfile.is_open())
{
while (getline (myfile,line))
{
cout << "You already have a save file!\n";
}
myfile.close();
myfile.clear();
authlog = myfile;
myfile.open("username.txt");
cout << "Enter your username:\n";
cin >> auth;
if(auth == authlog)
{
}
}
'authlog'的類型是什麼? – Jiahao
這不是導致錯誤的代碼...請提交驗證碼.. – Arvindsinc2
驗證日誌是一個字符串,但在此處未顯示。 – Loopahnoob