Vote count:
0
I'm trying to compare the values in these two char pointers but i'm getting strange outputs:
The first one is (libpcap IP address):
const char* ip_source = inet_ntop(AF_INET, &ip->ip_src, buffer1, sizeof(buffer1)); //192.168.56.1
The second one is:
char *host_ip = inet_ntoa(((struct sockaddr_in*)a->addr)->sin_addr); //192.168.56.1
I've tried using if (*ip_source == *host_ip) and if (strcmp(ip_source, host_ip) == 0).
How do I compare the IP addresses stored in these two variables to see if both IP addresses are the same?
asked 5 mins ago
Compare Const char* and char *
Aucun commentaire:
Enregistrer un commentaire