结果在Visual Studio中返回“ a”,但在dev中返回“ b”。 使用开发人员创建了文件“ temp3.txt”,但重命名和删除均无效, 在Visual Studio中,一切正常。
ofstream adminsNewPass("temp3.txt");
for (i = 1; i <=90; i++)
{
adminsNewPass << adminName[i] << " " << adminReset[i] << endl;
if (adminsNewPass.eof())
{
break;
}
}
adminsNewPass.close();
remove("admins.txt");
int result;
result = rename("temp3.txt", "admins.txt");
if (result == 0)
{
cout << "a";
}
else
{
cout << "b";
}