使用C语言怎么获取U盘的序列号,求解
还没学到那里要用
MSDN查到用GetVolumeInformation
http://msdn.(VS.85).aspx
程序代码:
#include <windows.h> #include <stdlib.h> #include <stdio.h> #include <tchar.h> BOOL WINAPI GetVolumeInformation(); LPCTSTR lpRootPathName = _T("C:\\"); LPTSTR lpVolumeNameBuffer; DWORD nVolumeNameSize = 255; LPDWORD lpVolumeSerialNumber; LPDWORD lpMaximumComponentLength; LPDWORD lpFileSystemFlags; LPTSTR lpFileSystemNameBuffer; DWORD nFileSystemNameSize = 255; int main(int argc, char *argv[]) { GetVolumeInformation(lpRootPathName,lpVolumeNameBuffer,nVolumeNameSize,lpVolumeSerialNumber,lpMaximumComponentLength,lpFileSystemFlags,lpFileSystemNameBuffer,nFileSystemNameSize); printf("%s\n",lpVolumeSerialNumber); system("pause"); return 0; }