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. Check file in use

Check file in use

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialcareer
5 Posts 3 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.
  • K Offline
    K Offline
    Karismatic
    wrote on last edited by
    #1

    Hi All, I am not able to find out the solution of how to find out whether a file is ready to use or not. I have tried several ways to do this but unable to do the same, please refer me to some solution.

    Regards, Pankaj Sachdeva There is no future lies in any job but future lies in the person who holds the job

    S 1 Reply Last reply
    0
    • K Karismatic

      Hi All, I am not able to find out the solution of how to find out whether a file is ready to use or not. I have tried several ways to do this but unable to do the same, please refer me to some solution.

      Regards, Pankaj Sachdeva There is no future lies in any job but future lies in the person who holds the job

      S Offline
      S Offline
      SandipG
      wrote on last edited by
      #2

      Karismatic wrote:

      whether a file is ready to use or not.

      What does you mean by this??

      Regards, Sandip.

      S 1 Reply Last reply
      0
      • S SandipG

        Karismatic wrote:

        whether a file is ready to use or not.

        What does you mean by this??

        Regards, Sandip.

        S Offline
        S Offline
        Saurabh Garg
        wrote on last edited by
        #3

        What do you mean by file is ready? Saurabh

        K 1 Reply Last reply
        0
        • S Saurabh Garg

          What do you mean by file is ready? Saurabh

          K Offline
          K Offline
          Karismatic
          wrote on last edited by
          #4

          I mean one process in writting a file which i want to access but before I open it i want to test whether it is written completely or not. I am using this code but it is not working properly // attempt to open existing file. FileHandle = CreateFile (FileName, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); // if unable to open the file // then return failure. if (FileHandle == INVALID_HANDLE_VALUE) { // return failure. return (FALSE); } // if FileHandle // close the open file handle. CloseHandle (FileHandle); return TRUE

          Regards, Pankaj Sachdeva There is no future lies in any job but future lies in the person who holds the job

          S 1 Reply Last reply
          0
          • K Karismatic

            I mean one process in writting a file which i want to access but before I open it i want to test whether it is written completely or not. I am using this code but it is not working properly // attempt to open existing file. FileHandle = CreateFile (FileName, GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); // if unable to open the file // then return failure. if (FileHandle == INVALID_HANDLE_VALUE) { // return failure. return (FALSE); } // if FileHandle // close the open file handle. CloseHandle (FileHandle); return TRUE

            Regards, Pankaj Sachdeva There is no future lies in any job but future lies in the person who holds the job

            S Offline
            S Offline
            SandipG
            wrote on last edited by
            #5

            Why don't you use some synchronization technique between the two processes??

            Regards, Sandip.

            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