Exception in File Handling

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jaya Sudha M
    New Member
    • Sep 2006
    • 1

    Exception in File Handling

    Hi
    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.
  • Banfa
    Recognized Expert Expert
    • Feb 2006
    • 9067

    #2
    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.

    Comment

    Working...