inet_ntoa is a UNIX system call used in socket programming to obtain an IPv4 string form of an IP address from its in_addr form.
I have encountered an issue where its use results in the following warning:
warning: assignment makes pointer from integer without a cast
Attempting to run a program with this warning on inet_ntoa will result in a segmentation fault.
The cause of the problem is not incorrect C, but a missing header file. Shachar Shemesh wrote that the solution to this obscure problem is simply to include the arpa/inet.h header file:
#include <arpa/inet.h>
Thank you SOOOO much for this, was pulling my hair out :)
ReplyDeleteMe too, I'd never have found the solution to this under osx without this post!
ReplyDeleteColum
You are awesome!!!.....spend a lot of time on the issue....header file inclusion worked!!
ReplyDeleteCan you please explain why it works?
Thanks,
Prasad
I'm afraid I don't know how to answer that. Do post here if you find out.
ReplyDelete