我的IDE在最後一行有「filename」變量。有人能指出我爲什麼嗎?ofstream variable.open是否支持預定義的字符串變量?
switch(filename_selection)
{
case 1: filename_selection = 1;
filename = "foo3.sql";
break;
case 2: filename_selection = 2;
filename = "foo2.sql";
break;
case 3: filename_selection = 3;
filename = "foo1.sql";
break;
default:
cout << "Invalid selection." << endl;
break;
}
ofstream File;
File.open(filename, ios::out | ios::trunc);
* What * issues ...?你的'filename'是如何定義的? – Xeo 2012-02-10 02:03:52
此外,您將'filename_selection'重新賦值給它的原因是什麼? – Xeo 2012-02-10 02:13:11
菜鳥錯誤,真的。讀入此。 – Switchkick 2012-02-10 02:29:57