中(システム - > wgetの)コマンドここでは私のコードです:問題C++
string line;
ifstream toOpen;
toOpen.open("allfiles.txt", ios::in);
int fileCounter=0;
if(toOpen.is_open()){
while(!toOpen.eof()){
getline(toOpen,line);
string dl = "wget -q -E -O superman/" + href[0] + " " + line;
//cout << dl << endl;
fileCounter++;
system(dl);
}
toOpen.close();
}
allfiles.txt(コンテンツ):hrefの[]の値がある
http://www.xxx.com/index1.html
http://www.xxx.com/index2.html
以下のような:{index1.html、index2.html、index3.html ...}
マイエラーメッセージ:
file.cpp:XX: error: cannot convert ‘std::string’ to ‘const char*’ for argument ‘1’ to ‘int system(const char*)’
あなたは本当に 'std :: string :: c_str()'に出くわしたことはありませんか? –
@ignacio:私は今それを得ると思います。このような質問には申し訳ありません。私はちょうどC++を始めた – popurity09