This is the mail archive of the
libc-help@sourceware.org
mailing list for the glibc project.
Re: inet_aton 0x0 in integer in structure
- From: Florian Weimer <fw at deneb dot enyo dot de>
- To: alleswirdbesser at posteo dot de
- Cc: libc-help at sourceware dot org
- Date: Thu, 11 May 2017 20:44:03 +0200
- Subject: Re: inet_aton 0x0 in integer in structure
- Authentication-results: sourceware.org; auth=none
- References: <4118714c1220c06d434f608997a8bb3c@posteo.de>
> #include <stdio.h>
> #include <netinet/in.h>
> #include <arpa/inet.h>
> #include <sys/socket.h>
>
> int main ()
> {
> const char *name="201.23.23.44";
> struct in_addr *ipaddr;
> int valide;
> valide = inet_aton (name, ipaddr);
> printf ("valide: %d. \nIP-Adresse: %d", valide, (*ipaddr).s_addr );
> return 0;
> }
This is not valid C code. You need to initialize ipaddr to point to
an object of type struct in_addr.
I don't know how much you know about C programming, so it's difficult
to explain for me what's going on here.