你好我有一點麻煩,此代碼輸出文件名
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
int main()
{
string line;
//const char* test = "connect";
#define test "connect"
string con("c:\\filepath\\%s.txt", test);
ifstream file;
file.open(con.c_str());
if (file.is_open()) {
while (file.good()) {
getline(file, line);
printf("setc %s\n", line.c_str());
//cout << "setc " << line << endl;
}
file.close();
} else
cout << "Unable to open file";
return 0;
}
可能有人請告訴我,我錯了
這就是我所追求的
「騙子」是爲了從「測試」
得到它的文件名,如果你能幫助我,我將不勝感激:)
''鍵通常位於鍵盤的左上角。現在您知道在哪裏可以找到它,但沒有任何東西阻止您使用它。 –
2012-12-23 09:22:40