Getting an error trying to write to USB. CreateFile() returns 0x82 (The directory or file cannot be created). File being copied to the root folder. The problem ended up being that the USB drive is FAT formatted. I found this out when on a hunch I manually dragged and dropped the file onto the USB, and got a Windows dialog that said "The root drive I:\ is formatted with the FAT fiel system and can only store a limited number of items. Store the items in a subfolder, or reformat the drive using the NTFS file system".
Working on Win7 with VS2010 C++. I need to be able to give the user feedback about what the problem is, rather than just the generic "The directory or file cannot be created".
Is there a way that I can query the USB drive to find out if the error came up because of having passed the maximum number of files allowed in the root folder? A call to GetVolumeInformation() doesn't seem to give me this information, and a search of the net doesn't show anyone talking about how to do this (or I am not finding the right question to ask).
Since there are FAT8, FAT12, FAT16 and FAT32 out there, I'm assuming these each have different maximums on the number of folders/files in the root folder. I did find that FAT32 allows the number of files in the root folder to grow, which seems to say that there is no specific maximum number of folders/files for root in FAT32. But for FAT16 there seems to be, and so the other formats, may have different maximums.
Any idea where I could look next for this type of information. Thanks ahead of time for any help.