Reading/Writing data from/to usb device
Hi there !
I need to detect when an usb key is plugged and I also need to access (read/write) data stored onto that key.
In my opinion the main problem is to auto detect the usb device ... then I imagine it is easy to read/write data (as it is on a hard drive).
Could someone tell me how to detect the usb key ?
Thanks in advance.
Re: Reading/Writing data from/to usb device
Two ways.
Proper one:
You should plug into some platform dependent routines which notify for such events. Windows probably has some api for this, but it's out of scope of this forum, so you'd have to find experts on this topic.
Workaround:
Monitor the list of drives yourself and act when something is added to the list. Just remember it can be some other device (cdrom?), not only a usb drive.
Re: Reading/Writing data from/to usb device
Seems that you mainly concern on a Windows specific solution. You could take a look at:
How to match between physical usb device and its drive letter? and The Mass Storage Page. Wysota's #2 is easier ;)