Results 1 to 2 of 2

Thread: C++ system commands

  1. #1
    Join Date
    Sep 2009
    Beans
    2

    C++ system commands

    cout << "Enter in the URL" << endl;
    cin >> URL;
    system("Ping");

    i am trying to get the URL after the ping but im new in C++ and do not know the code to ping URL

  2. #2
    Join Date
    Sep 2006
    Location
    .nl
    Beans
    Hidden!
    Distro
    Ubuntu 9.04 Jaunty Jackalope

    Re: C++ system commands

    Code:
    #include <iostream>
    #include <string>
    #include <stdlib.h>
    
    int main()
    {
        std::cout << "Enter url: ";
        std::string url;
        std::cin >> url;
        url = "ping " + url;
        return system(url.c_str());
    }
    You should probably go to a C++ forum, though. Try cplusplus.com

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •