微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何检查C ++中是否存在网络适配器Windows

如何解决如何检查C ++中是否存在网络适配器Windows

我需要定期检查Windows下是否存在网络适配器,我尝试使用String,但是它没有返回“名称”(如“ Local Area Connection 1”(我需要)),但是返回的却很长。 ID。 我还找到了该代码here):

 * The string if formatted as follow:
 *  - Each row of the matrix is separated by a newline
 *    character \n
 *  - Each element of the rows are separated by a space
 *  For example,the String "0 1\n2 3" represent the
 *  matrix:
      [0 1]
      [2 3]
  

但是我不能移植到Windows上。

我还有一个完美的命令:

int[][] tab = null 
int compteur = 0
int position = 0
for (int i = 0; i < s.length(); i++) {
    char l = s.charat(i);
    String p = String.valueOf(l);
    if (Character.isDigit(s.charat(i))) {
        tab[compteur][position] = s.charat(i);
        position++;
    else if(p.equals("/n")) {
        position = 0;
        compteur ++;
    }
}
return tab

但是在c ++中,似乎需要首先写入文件以读取命令的结果(使用GetInterfaceInfo),并且由于可能每秒检查一次,所以我想避免磁盘操作。 / p>

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。