"emanshu" <mu*******@gmail.com> wrote in message
news:11*********************@g14g2000cwa.googlegro ups.com...
HI all,
I an designing an application in C++. i want to open file requested by
end user but i want to reflect an error to user if file is already
opened by some other application..
will anybody tell me that how to know that the file is already open or
closed..
The only thing the C++ library mechanisms for opening a file
can tell you is whether the attempt succeeded or failed. If
it failed, reason(s) for *why* it failed are necessarily platform
specific. Most implementations provide extensions for things like this
when they apply.
Note that it's conceivable for an OS to have a file system where it's
perfectly valid to open an already open file.
This platform neutrality of C++ is also why it's not possible
(using only standard code) to determine conclusively whether
a file exists or not.
-Mike