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. Checking is a file has been already locked...

Checking is a file has been already locked...

Scheduled Pinned Locked Moved C / C++ / MFC
question
6 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.
  • A Offline
    A Offline
    Abhijeet Pathak
    wrote on last edited by
    #1

    Hi, how can i check, given a file name, if the file has been 'locked' by any process... either for reading, writing or both? Thanks... ------------------------------------------------------------ Never wear anything that panics the cat.

    D D 2 Replies Last reply
    0
    • A Abhijeet Pathak

      Hi, how can i check, given a file name, if the file has been 'locked' by any process... either for reading, writing or both? Thanks... ------------------------------------------------------------ Never wear anything that panics the cat.

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      Can you open the file exclusively?


      "A good athlete is the result of a good and worthy opponent." - David Crow

      "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

      A 1 Reply Last reply
      0
      • A Abhijeet Pathak

        Hi, how can i check, given a file name, if the file has been 'locked' by any process... either for reading, writing or both? Thanks... ------------------------------------------------------------ Never wear anything that panics the cat.

        D Offline
        D Offline
        DevMentor org
        wrote on last edited by
        #3

        do you know how to open a file and lock it yourself ;P that might give you an idea!!!

        Yours Truly, The One and Only!

        A 1 Reply Last reply
        0
        • D David Crow

          Can you open the file exclusively?


          "A good athlete is the result of a good and worthy opponent." - David Crow

          "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

          A Offline
          A Offline
          Abhijeet Pathak
          wrote on last edited by
          #4

          Actually, I want to check whether a file is locked by *any process*, be it my own app or any other process... I'm aware of file locking functions when we open a file ourselves... but what about the files that are locked by some other app..?

          D 1 Reply Last reply
          0
          • D DevMentor org

            do you know how to open a file and lock it yourself ;P that might give you an idea!!!

            Yours Truly, The One and Only!

            A Offline
            A Offline
            Abhijeet Pathak
            wrote on last edited by
            #5

            _NightOwl_ wrote:

            do you know how to open a file and lock it yourself that might give you an idea!!! Yours Truly, The One and Only!

            Actually, I want to check whether a file is locked by *any process*, be it my own app or any other process... I'm aware of file locking functions when we open a file ourselves... but what about the files that are locked by some other app..? ------------------------------------------------- No me, no life.. know me, know life..

            1 Reply Last reply
            0
            • A Abhijeet Pathak

              Actually, I want to check whether a file is locked by *any process*, be it my own app or any other process... I'm aware of file locking functions when we open a file ourselves... but what about the files that are locked by some other app..?

              D Offline
              D Offline
              David Crow
              wrote on last edited by
              #6

              Abhijeet Pathak wrote:

              ...but what about the files that are locked by some other app..?

              If a file is open by another process, and your process tried to open the file exclusively, it would fail.


              "A good athlete is the result of a good and worthy opponent." - David Crow

              "To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne

              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