Skip to main content

Command Palette

Search for a command to run...

Day 11/100 100 days of Code

Info Hunter

Published
1 min read
Day 11/100 100 days of Code
C

AKA Chris, is a software developer from Athens, Greece. He started programming with basic when he was very young. He lost interest in programming during school years but after an unsuccessful career in audio, he decided focus on what he really loves which is technology.

He loves working with older languages like C and wants to start programming electronics and microcontrollers because he wants to get into embedded systems programming.

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 google.com. If the ping fails, then the computer has no internet access. Here is the function I created:

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

    if (getVal != 0)
    {
        return false;
    }

    return true;
}

100 Days of Code

Part 11 of 50

100 days of code is a good initiative to go into hard mode and spend more time in programming. These 100 days will be focused on completing projects and research.

Up next

Day 12/100 100 Days of Code

Info Hunter