How can I restrict a user to open the same file on multiple instances of the same application???? If you have word installed, then open multiple instances of it and try opening the same file on all the application...The user is restricted. How can I achieve this???
NOTE: I'm not looking how microsoft have implemented that but looking for a portable solution
which can work both on windows and linux.
After search on google I came to know that I need to lock the file( exclusive lock) and then unlock again. I came across this link
That link uses
void _lock_file(FILE* file);
. In my application I use ifstream to read a file. I dont have any FIlE*.
So can anyone there tell me how can I lock a file using ifstream or some solution where I can restrict the user to open the same file on different instances of same application.