hier ist mein Code:Problem mit bash (System-> wget) Befehl in 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();
}
Wo die allfiles.txt (der Inhalt):
http://www.xxx.com/index1.html
http://www.xxx.com/index2.html
Wo href [] Werte wie: {index1.html, index2.html, index3.html ...}
Meine Fehlermeldung:
file.cpp:XX: error: cannot convert ‘std::string’ to ‘const char*’ for argument ‘1’ to ‘int system(const char*)’
Haben Sie wirklich nie 'std :: string :: c_str()'? –
@ignacio: Ich denke, ich verstehe es jetzt. Entschuldigung für diese Art von Noob-Frage. Ich habe gerade mit C++ angefangen – popurity09