#include #include #include #include int main() { struct in_addr ip_addr; //FILE *ifs = fopen("/proc/at_routing/at_gateways", "r"); ifstream gwFile("/proc/at_routing/at_gateways"); if(!ifs) { cout << "Error: File could not be opened" << endl; return 1; } while(ifs) { gwFile >> ip_addr.s_addr; printf("ip address: %s\n", inet_ntoa(ip_addr)); } return 0; }