在下面的代碼段第三行:net_ntoa,結構SOCKADDR_IN和指針轉換
char cli_ip[20];
struct sockaddr cliaddr;
.......
memcpy(cli_ip, inet_ntoa(((struct sockaddr_in *)cliaddr)->sin_addr), 20);
我得到的錯誤:
udp_receiver.c:96:41: error: cannot convert to a pointer type udp_receiver.c:96:41: warning: passing argument 2 of ‘memcpy’ makes pointer from integer without a cast [enabled by default] /usr/include/string.h:44:14: note: expected ‘const void * restrict’ but argument is of type ‘int’
是什麼原因?
-1在獲得答案後,千萬不要完全改變問題! - 如果您有其他問題,請將其作爲新帖子。 – deepmax 2013-04-09 08:55:01
至於@MM。請注意,請不要以這種方式編輯您的問題。你的新錯誤顯然是一個不同的問題。 – 2013-04-10 04:16:15