Before calling system() you'll need to combine the strings/integers/other stuff using sprintf();
Example:
char ip1[] = "127.0.0.1";
char pszBuffer[32];
sprintf(pszBuffer, "ping %s", ip1);
// pszBuffer now contains "ping 127.0.0.1;
Now, to increment the IP is going to be a little tricky. You could make your own structure / class for IP's which would encapsulate all this... but here goes.
Code:
char *incrementIP(char *pszIP)
{
char cDelim = '.';
unsigned int iIPField[4];
int i = 0;
do {
iIPField[i] = atoi(strtok(NULL, cDelim));
i++;
} while (i < 4);
i = 4;
while (iIPField[i] == 255)
{
iIPField[i] = 0;
i--;
} else {
iIPField[i]++;
}
char pszReturnIP[16];
sprintf(pszReturnIP, "%s.%s.%s.%s", iIPField[0], iIPField[1], iIPField[2], iIPField[3]);
return pszReturnIP;
}
Note, I didn't test this... it's almost 3AM, I have no clue why I just wrote that for you but I did... the function doesn't check for validity of the IP address... it assumes a real address is given (4 fields seperated by periods.