voici mon code:problème avec bash (Système-> wget) commande en 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();
}
Lorsque le allfiles.txt (le contenu):
http://www.xxx.com/index1.html
http://www.xxx.com/index2.html
Où href [] valeurs comme: {index1.html, index2.html, index3.html ...}
Mon message d'erreur:
file.cpp:XX: error: cannot convert ‘std::string’ to ‘const char*’ for argument ‘1’ to ‘int system(const char*)’
Avez-vous vraiment jamais rencontré 'std :: string :: c_str()'? –
@ignacio: Je pense que je comprends maintenant. Désolé pour ce genre de question Noob. Je viens de commencer C++ – popurity09