By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,962 Members | 1,791 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,962 IT Pros & Developers. It's quick & easy.

Exception in File Handling

P: 1
i am working in Visual c++.i am a beginner in programming.

To read a .cfg file i am using ifstream class. If the.cfg file is opened for write mode in another applciation then when my application opens it for reading, the file should not be opened and application should terminate saying " file is used in another application".
How do i handle this exception.
is there any way i can solve this using CFile classes or any suggestions.
Thanks in advance.
Sep 18 '06 #1
Share this Question
Share on Google+
1 Reply

Expert Mod 5K+
P: 8,916
It depends how the other program has opened the file. If it has not opened it in a mode that allows shared file opening then the open will fail or the construction will throw an exception which you can catch.
Sep 18 '06 #2

Post your reply

Sign in to post your reply or Sign up for a free account.