bil*_*ong 4 filesystems operating-system
操作系统如何知道分区正在使用什么文件系统?换句话说,FAT16/32、NTFS、ext2/3等如何区分?
如果您在 Windows 上使用 Win32 API,则可以调用 GetVolumeInformation ( http://msdn.microsoft.com/en-us/library/aa364993.aspx ) 来确定给定安装卷上存在的文件系统类型。
例如,如果您尝试检测 D: 上存在的文件系统,则可以调用:
WCHAR FSType[512];
if (GetVolumeInformationW(L"D:\\", NULL, 0, NULL, NULL, NULL, FSType, ARRAYSIZE(FSType))) {
wprintf(L"FS type = %s\n", FSType);
}
Run Code Online (Sandbox Code Playgroud)
然而,只有当文件系统被正在运行的操作系统“识别”和“可安装”时,这才有效。