I'm totally new to coding. I need an advice from veteran because I doing this for my part of my task.

Is there a way to read a string generated by Command Prompt (CMD)?

My task is to create a code to ping all the network and assign IP address as active and inactive through Input/output with files perhaps.

I wanted to copy a string from cmd for example:

Reply from 192.168.0.1: bytes=32 time<1ms TTL=64 <- (This indicate active)
Reply from 192.168.0.2: Destination host unreachable <- (This indicate inactive)

If I able to copy that line, I can write a If/Else condition to separate them. If there is any easier way to improve this scenario, please do assist me. Thank you.

The code below is to ping all IP Address until 255, but I still need 1 more function which to separate Active and Inactive IP Addresses.

```
    using namespace std;

    void main()
    {
    string ipAddress;

    cout << "Enter the IPv4 address network..." << endl;
    cout << "Example: 10.0.0. or 192.168.1." << endl;

    getline(cin, ipAddress);
    cout << "Please wait..." << endl;

    string s = "ping " + ipAddress;

    for (int x = 0; x <= 255; ++x)
            {
                    stringstream ss;
                    ss << x << endl;
                    string newString = ss.str();
                    string finalString = s + newString;

                    system(finalString.c_str());
            }

    system("pause");
    }

```

P.S I also post in <http://www.cplusplus.com/forum/beginner/196197/>