linux下用代码获取主板序列号
来源:互联网 发布:华为路由器联网端口 编辑:程序博客网 时间:2024/05/02 01:43
/* ************************************************************************ * Filename: system_test.c * Description: * Version: 1.0 * Created: 2015年04月12日 10时41分49秒 * Revision: none * Compiler: gcc * Author: YOUR NAME (), * Company: * ************************************************************************/#include <stdio.h>#include <sys/wait.h>#include <stdlib.h>#include <unistd.h>int main(int argc, char *argv[]){pid_t pid;int ret = 0;int fd[2] = {0};//创建管道ret = pipe(fd);if(ret == -1){perror("pipe");_exit(1);}//创建子进程,目的 1exec 2复制管道文件描述符pid = vfork();if(pid < 0){perror("vfork");}else if(pid == 0){dup2(fd[1], 1);//标准输出重定向到管道的写端char str[50]="dmidecode -s system-serial-number";execlp("/bin/sh","sh","-c",str,NULL);}else{char result[100] = "";read(fd[0], result, sizeof(result));//从管道的读端读取数据char msg[100] = "";sprintf(msg, "%c%c:%c%c:%c%c:%c%c:%c%c:%c%c:%c%c:%c%c:%c%c:%c%c:%c%c:%c%c:%c%c:%c%c:%c%c:%c%c",result[7],result[8],result[10], result[11],result[13],result[14],result[16],result[17], result[19],result[20],result[22],result[23],result[25], result[26],result[28],result[29],result[31],result[32], result[34],result[35],result[37],result[38],result[40], result[41],result[43],result[44],result[46],result[47], result[49],result[50],result[52],result[53]);printf("---->%s\n",msg);}return 0;}
0 0
- linux下用代码获取主板序列号
- linux下获取CPUID,MAC地址,硬盘序列号,主板序列号
- linux下获取CPUID,MAC地址,硬盘序列号,主板序列号
- 获取主板序列号
- 获取主板序列号
- python在windows下获取cpu、硬盘、bios、主板序列号
- 如何获取硬盘序列号与主板序列号
- ubuntu获取CPU序列号或者主板序列号
- JAVA获取CPU 硬盘 及主板序列号
- C++ 硬件信息 获取主板序列号
- JAVA获取CPU 硬盘 及主板序列号
- java获取CPUID、网卡MAC、硬盘序列号、主板序列号
- linux下获取硬盘的序列号信息
- Linux环境下获取硬盘序列号、型号
- 通过WMI获取网卡MAC地址、硬盘序列号、主板序列号、CPU ID、BIOS序列号
- 通过WMI获取网卡MAC地址、硬盘序列号、主板序列号、CPU ID、BIOS序列号
- 通过WMI获取网卡MAC地址、硬盘序列号、主板序列号、CPU ID、BIOS序列号
- 通过WMI获取网卡MAC地址、硬盘序列号、主板序列号、CPU ID、BIOS序列号
- 原来自己统计的设备数,用IMEI和MAC地址全不准
- oracle 11g 静默安装
- GEASP(职责分配原则)
- Android 缓存原理(一)----ListView缓存机制
- 第六届蓝桥杯A组C/C++ 第五题 九数组分数
- linux下用代码获取主板序列号
- javamail发送邮件的简单实例
- 环境的力量
- 详解js跨域问题(推荐阅读)
- Jeecg二级联动
- cogs爱争吵的猴子 题解
- 起泡排序bubblesort
- php函数(今天才看到的记载下来)
- CRichEditCtrl 控件设置透明后,未手动刷新使得显示字体重叠