Linux C/C++ ping_check_Internet(網路測試)
Linux C/C++ ping_check_Internet(網路測試)
資料來源: https://github.com/jash-git/Jash_LinuxC/tree/master/Linux_CPP_ping_check_Internet
code:
#include <iostream> #include <cstdio> #include <cstdlib> #include <cstring> using namespace std; int main() { if (system("ping -c1 -s1 www.google.com")) { cout << "There is no internet connection \n"; } else { cout << "There is internet connection \n"; } return 0; }