Hello everyone,
On Windows platform, which API could be used to check whether a file is opened (either by other thread or process or even the same thread) or not?
C++ is fine.
thanks in advance,
George
This is a discussion on check file opened or not? within the Windows Programming forums, part of the Platform Specific Boards category; Hello everyone, On Windows platform, which API could be used to check whether a file is opened (either by other ...
Hello everyone,
On Windows platform, which API could be used to check whether a file is opened (either by other thread or process or even the same thread) or not?
C++ is fine.
thanks in advance,
George
You can try to open the file with "NO sharing", then it will fail if some other process has the file open.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
ifstream is fine.
For information on how to enable C++11 on your compiler, look here.
よく聞くがいい!私は天才だからね! ^_^
ifstream::open with appropriate open protection constants, which I don't know what they're called or located.
Last edited by Elysia; 04-03-2008 at 07:18 AM.
For information on how to enable C++11 on your compiler, look here.
よく聞くがいい!私は天才だからね! ^_^
when you say a file do you mean a process or what , because your making it sound like a .txt file
For information on how to enable C++11 on your compiler, look here.
よく聞くがいい!私は天才だからね! ^_^
I don't know, but I doubt it. The class takes its arguments from ios_base.
For information on how to enable C++11 on your compiler, look here.
よく聞くがいい!私は天才だからね! ^_^
and to check if its open ?
i would check if the process notepad is open then use FindWindow to check is the string of the windowtext is matching your textfile description
George wants to find out if the file is open, not if a process is open. And this doesn't just include Notepad. What you describe is a really horrible way of doing it.
For information on how to enable C++11 on your compiler, look here.
よく聞くがいい!私は天才だからね! ^_^