[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: inet_ntoa() problem on VI powerpc



> #include <sys/types.h>
> #include <netinet/in.h>
> #include <arpa/inet.h>
> main() {
> unsigned long tmp;
> tmp =  inet_addr("100.0.0.1");
> printf("Hex addr: %x\n",tmp);
> printf("IP addr: %s\n",inet_ntoa(tmp));
> }
> 
> 'Make' complains of an 'incompatible type for argument 1' being
> passed to inet_ntoa().  If I compile using -traditional, the error
> goes away, but the program core dumps on the inet_ntoa() call.
> This same code works fine on a PC running 2.5.
> 

this doesnt compile on my i386 running -current.

> Any ideas on what might be happening or what include file I need
> to add/modify?

this does...
change your printf to this:

printf("IP addr: %s\n",inet_ntoa(*(struct in_addr *)&tmp));



> 
> Thanks,   Sam G.


hope that works. :)
mike.