#include #include #include #include int main() { struct in_addr ip_addr; FILE *ifs = fopen("/proc/at_routing/at_gateways", "r"); FILE *ofs = fopen("/proc/at_routing/at_routable", "r"); if(ifs == NULL || ofs == NULL) { printf("Error: File could not be opened\n"); return 1; } printf("***********Printing Gateways************\n"); while(fscanf(ifs, "%u", &ip_addr.s_addr) != EOF) { printf("ip address: %s\n", inet_ntoa(ip_addr)); } printf("***********Printing Routables************\n"); while(fscanf(ofs, "%u", &ip_addr.s_addr) != EOF) { printf("ip address: %s\n", inet_ntoa(ip_addr)); } return 0; }