How do you get the mount point/disk drive of a USB stick in cross-platform C++ or C?
I'm trying to get the mount point(linux/osx) or disk drive (wi开发者_开发技巧ndows) of a specific USB mass storage device.
I can use libusb to determine if the correct device is inserted but how do I determine where it is mounted?
I'm using C++ but I assume C code would work just as well. Cross-platform code would be preferable.
The C standard library provides no facilities for this, so true cross platform compatibility is not possible. On Windows you use a combination of GetLogicalDrives, and GetLogicalDriveType, as described here. You could probably map that information to your device by using GetVolumeInformationByHandleW.
精彩评论