This is the mail archive of the libc-help@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: inet_aton 0x0 in integer in structure


> #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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]