问题描述
我需要定期检查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 (将#修改为@)