Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Application crash when reading file from mapped network drive is discoonected

Application crash when reading file from mapped network drive is discoonected

Scheduled Pinned Locked Moved C / C++ / MFC
sysadmintutorial
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    shanmugarajaa
    wrote on last edited by
    #1

    Hi friends, case 1: I am opening a file from network drive location. During file read, the mapped network drive is disconnected, my application get crashed and closed. how to check the mapped network drive is connected or not using file pointer. case 2: during file read, I am disconnecting and connecting the mapped network drive that time pointer is not null. but I cant able to access a file using this file pointer. Thanks, S Shanmuga Raja

    L A A 3 Replies Last reply
    0
    • S shanmugarajaa

      Hi friends, case 1: I am opening a file from network drive location. During file read, the mapped network drive is disconnected, my application get crashed and closed. how to check the mapped network drive is connected or not using file pointer. case 2: during file read, I am disconnecting and connecting the mapped network drive that time pointer is not null. but I cant able to access a file using this file pointer. Thanks, S Shanmuga Raja

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      You should use a try/catch block to catch exceptions that occur in such circumstances, and/or check the status of any file access calls.

      1 Reply Last reply
      0
      • S shanmugarajaa

        Hi friends, case 1: I am opening a file from network drive location. During file read, the mapped network drive is disconnected, my application get crashed and closed. how to check the mapped network drive is connected or not using file pointer. case 2: during file read, I am disconnecting and connecting the mapped network drive that time pointer is not null. but I cant able to access a file using this file pointer. Thanks, S Shanmuga Raja

        A Offline
        A Offline
        achal3754
        wrote on last edited by
        #3

        1. You should handle the exception. 2. You can write a method to check connection (through ping).

        1 Reply Last reply
        0
        • S shanmugarajaa

          Hi friends, case 1: I am opening a file from network drive location. During file read, the mapped network drive is disconnected, my application get crashed and closed. how to check the mapped network drive is connected or not using file pointer. case 2: during file read, I am disconnecting and connecting the mapped network drive that time pointer is not null. but I cant able to access a file using this file pointer. Thanks, S Shanmuga Raja

          A Offline
          A Offline
          Ashish Tyagi 40
          wrote on last edited by
          #4

          If you share which API you are using for file I/O then you'd get answer more accurately. Did you used std::fstream or some other API?

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups