环境:
版本:银河麒麟桌面操作系统V10(SP1)
内核:Linux 5.4.18-35-generic
CPU:Phytium,D2000/8
终端输入 uname -m 查看
架构 aarch64
在windows 上 和 银河麒麟(linux loongarch64) 使用下面的代码获取IP地址:
银河麒麟(linux) gethostname 获取不到IP地址_程序媛zcx的博客-优快云博客_银河麒麟查看ip地址
同样的代码 在银河麒麟(linux 架构loongarch64)可以,但是在 银河麒麟(aarch64)上不可以,于是用读文件的方式获取所有ip地址列表,代码如下:
std::vector<std::string> WHUDP:: getIpList() {
std::vector<std::string> result;
char buff[BUFSIZ];
int i=0,k=0;
char tmpbuff[1];
int ret=0;
FILE * addrFile;
addrFile = popen("ifconfig", "r");
memset(buff,0,BUFSIZ);
while(1) {
ret = fread(