报错代码:
strcpy(temp, (char *)ether_ntoa(LLADDR(sdl)));

解决方法:

导入这三个头文件即可,
#include <sys/types.h>
#include <sys/socket.h>
#include <net/ethernet.h>

然后上面那行代码会有一个警告:"Incompatible pointer types passing 'caddr_t' (aka 'char *') to parameter of type 'const struct ether_addr *'" ;
可以在LLADDR的前面加上(const struct ether_addr *) 也就是这样:
strcpy(temp, (
char *)ether_ntoa((const struct ether_addr *)LLADDR(sdl)));
这样就没有警告了。

 

相关文章:

  • 2021-11-04
  • 2022-12-23
  • 2021-05-13
  • 2022-12-23
  • 2022-12-23
  • 2022-01-28
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-16
  • 2021-05-03
相关资源
相似解决方案