Generation

generate functionMon, 03 Jul 2023

programa corto en c++ buscar por nombre interfaces de red linux

#include <stdio.h> #include <stdlib.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <arpa/inet.h> #include <netdb.h> #include <string.h> #include <strings.h> #include <unistd.h> #define MAX_LEN 1024 int main() { struct ifconf ifc; struct ifreq ifr[10]; int x, fd; fd = socket(AF_INET, SOCK_DGRAM, 0); if (fd == -1) { perror("socket()"); exit(1); } ifc.ifc_len = sizeof(ifr); ifc.ifc_buf = (char *)ifr; if (ioctl(fd, SIOCGIFCONF, &ifc) == -1) { perror("SI

Questions about programming?Chat with your personal AI assistant