最近在做存储这一块的东西,遇到了如何获取硬盘分区卷标的问题,也是刚学linux,就尝试的做了一次:
直接贴代码:
int fd;
char fattype[10];
char fatlabel[20];
fd = open(devicePath, O_RDONLY);
SLOGE("fd ok ");
if (fd < 0) {
SLOGE("open WUKAI faile ");
return 0;
}
lseek(fd, 0x52, SEEK_SET);
SLOGE("SEEK_SET fat type ok ");
if (read(fd, &fattype, 8) != 8) {
SLOGE("open error");
close(fd);
return 0;
}