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. A Simple Question about File Status

A Simple Question about File Status

Scheduled Pinned Locked Moved C / C++ / MFC
questiontutorial
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.
  • M Offline
    M Offline
    Maer727
    wrote on last edited by
    #1

    How to get file status? being read being write being opened closed Thanks

    P 1 Reply Last reply
    0
    • M Maer727

      How to get file status? being read being write being opened closed Thanks

      P Offline
      P Offline
      Per
      wrote on last edited by
      #2

      You can use CFile::GetStatus() /Per

      M 1 Reply Last reply
      0
      • P Per

        You can use CFile::GetStatus() /Per

        M Offline
        M Offline
        Maer727
        wrote on last edited by
        #3

        Thanks very much for your reply. I think the funtion CFile::GetStatus() can only get the static status of a file, for example, the access mode of a file. But I want to get a dynamic status of a file, for example, the status of being read. Do you have better methods. Thanks for helping me. Maer.

        P 1 Reply Last reply
        0
        • M Maer727

          Thanks very much for your reply. I think the funtion CFile::GetStatus() can only get the static status of a file, for example, the access mode of a file. But I want to get a dynamic status of a file, for example, the status of being read. Do you have better methods. Thanks for helping me. Maer.

          P Offline
          P Offline
          Per
          wrote on last edited by
          #4

          I'm not sure what you mean by 'being read'. If you mean 'is the file being read from right now' I don't know but if you mean 'when was the file last accessed' I think you can use GetStatus(). /Per

          M 1 Reply Last reply
          0
          • P Per

            I'm not sure what you mean by 'being read'. If you mean 'is the file being read from right now' I don't know but if you mean 'when was the file last accessed' I think you can use GetStatus(). /Per

            M Offline
            M Offline
            Maer727
            wrote on last edited by
            #5

            Thanks for your reply. I find the "GetStatus" function works well. It really resolves a part of my trouble. What I mean is "the file being read from right now", I have find a better method to resolve the problem. That is, to set a status bit to show the status. My project often reads and writes a lot of datas. It often takes a lot of time to do that task. To be more efficient, I want to check out the status of the file to give notifications to other threads waiting for reading/writing in the same file. Thanks again. Maer.

            L 1 Reply Last reply
            0
            • M Maer727

              Thanks for your reply. I find the "GetStatus" function works well. It really resolves a part of my trouble. What I mean is "the file being read from right now", I have find a better method to resolve the problem. That is, to set a status bit to show the status. My project often reads and writes a lot of datas. It often takes a lot of time to do that task. To be more efficient, I want to check out the status of the file to give notifications to other threads waiting for reading/writing in the same file. Thanks again. Maer.

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

              Hi If you use CreateFile() to open the files it's possible to set some extra options for access e.g.

              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