Day 11/100 100 days of Code

Info Hunter

Today I worked on implementing a function that ensures that the computer has access to the internet before starting any scraping operations.

I used a system ping command to ping If the ping fails, then the computer has no internet access. Here is the function I created:

bool Scraper::CheckForConnection()
    std::string createCommand = "ping -c1";
    int getVal = std::system(createCommand.c_str());

    if (getVal != 0)
        return false;

    return true;