/************************************************** ** BasicPing ** ** Description: Application to do a basic command ** line ping of google.com ** ** ** License: Mewcetti-amended MIT License ** http://mewcetti.com/2008/04/26/my-mit-license/ ***************************************************/ #include #include #include using namespace std; // Shorten our coding a little bit int main() { // create an int to hold the returned value, it returns a null or 0 if it's successful(on Windows NT at least) or a number int i; // We're pinging google.com but you can easily adapt this to ping whatever you want // Then we're storing the returned value in i i = system("ping google.com"); // The console doesn't output NULL values so if it IS null, we'll output it outselves if(i == NULL) { cout << endl << "NULL!" << endl; } // But if it's not a null, then show that value else { cout << endl << i << endl; } return 0; }