Bonjour,
J'ai écrit ce code mais j'ai une erreur lors de la compilation concernant la ligne system(cmd); car la variables cmd est de type std string et que la commande systeme souhaite une variables de type const char *.
Comment faire pour passé de l'un à l'autre?
void main (void) {
/****** Variables locales ******/
string range, IP, cmd ;
/****** Blocs d'instructions ******/
cout << "Range (xxx.xxx.xxx.) : ";
cin >> range;
for (int i = 1; i <= 255; i++){
// Convert Integer to String (use sstream library)
std::stringstream ConvertStream;
ConvertStream << i;
ConvertStream >> IP;
cmd = ("ping " + range + IP);
system(cmd);
}
}
ERREUR : error C2664: 'system' : cannot convert parameter 1 from 'std::string' to 'const char *'

(I read french fine, but I won't embarrass myself trying to write it)
Merci!