Hi!
There are two functions in my code:
I want to set IP address to an 4 element array in structure:Code:void *memcpy(void *dest, const void *src, size_t n); in_addr_t inet_addr(const char *cp);
But then I get an error:Code:memcpy(arp->src_pr_addr, inet_addr("127.0.0.1"), 4);
But when I define another variable and pass its address everything works:arp_request.c:53: warning: passing arg 2 of `memcpy' makes pointer from integer without a cast
How can I pass function directly to memcpy(); functions second argument? Do I need some casting? Thank you!Code:long ip = inet_addr("127.0.0.1"); memcpy(arp->src_pr_addr, &ip, 4);



LinkBack URL
About LinkBacks


