I am trying to write a rotuine, which will check whether a given file is already in use or not.
For writing this, I am using the routine, OpenFile with OF_SHARE_EXCLUSIVE mode.
When OpenFile is used on a file which is already opened by any other application, then it is returning error message (as it should) which is indicating that the file is already in use.
This seems to work fine only with Binary files.
when a text based file ( with extensions .txt, .cpp, .c and etc) , is opened by another applicaiton (for e.g. if file.c is opened in MSDEV) OpenFile is still able to get access to the file in OF_SHARE_EXCLUSIVE mode. Even from windows explorer also, the text based files opened in any other application can be deleted or modified without any problem.
Can someone tell me a way of checking both Text Based files and Binary files which are already in use ?