?? getharddisk.c
字號:
#include <sys/ioctl.h>#include <stdio.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include <linux/hdreg.h>static int open_flags = O_RDONLY|O_NONBLOCK;static int errno=1;int GetHardDisk(char * HardDisk,int len){ static struct hd_driveid id; int fd; char *devname="/dev/hda"; fd = open (devname, open_flags); if (fd < 0) { perror (devname); return -1; } ioctl (fd, HDIO_GET_IDENTITY, &id); sprintf (HardDisk,"\n Model=%.40s, FwRev=%.8s, SerialNo=%.20s\n", id.model, id.fw_rev, id.serial_no); close(fd); return 0;}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -