How can I programmatically check whether my machine has internet access or not using C/C++, is it just a matter of pinging an IP? How does NIC do it ? I mean something like
In addition to the InternetCheckConnection() function, The Win32 API has a function ( InternetGetConnectedState() ) which returns a true/false for (the availability of) some form of internet connectivity:
https://msdn.microsoft.com/en-us/library/windows/desktop/aa384702(v=vs.85).aspx
It also tells you what type of connection to the internet you have(LAN, modem, Proxy etc) - which can often be very handy to know.