Hi,
I used Keil sample program for USB detection and removal.
In my case, the USB is got detected and started file writing. But if i removed the USB in between the program is getting hanged.
After further analysis, its found that fclose() is causing the problem.
How could i solve this issue.
Regards, Arun
What do you expect to happen when you try to close a file on a storage device which is no longer physically connected to your system?!
Surely, fclose() must require that the filesystem containing the file is still there to be closed?
Close may be required, but having the ability to recover from unexpected situations is sure useful. And it's not as if pulling a usb stick is an unusual action.
Thank you for the reply.
How could i close the file where file handler is no longer valid.
Is there any method to handle this situation safely. My program is getting stuck because of unexpected removal of USB.
Regards Arun
Did you try the latest middleware version (v7.4) from Pack Installer ?
It should solve your issue.
Related: http://www.keil.com/forum/62422/#/msg204689 ?