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. Reg. win32_find_data dwFileAttributes value

Reg. win32_find_data dwFileAttributes value

Scheduled Pinned Locked Moved C / C++ / MFC
question
3 Posts 3 Posters 1 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.
  • R Offline
    R Offline
    Rakesh5
    wrote on last edited by
    #1

    hi all, i am actually trying to load a readonly file into my application. i am using CFileStatus's Getstatus method to find out the value of dwFileAttributes value. i am getting the value as 33.. my doubt is, do we get this value as 33 for all readonly files?? but in msdn, its been given as 1 for readonly file.. thanks, rakesh.

    C C 2 Replies Last reply
    0
    • R Rakesh5

      hi all, i am actually trying to load a readonly file into my application. i am using CFileStatus's Getstatus method to find out the value of dwFileAttributes value. i am getting the value as 33.. my doubt is, do we get this value as 33 for all readonly files?? but in msdn, its been given as 1 for readonly file.. thanks, rakesh.

      C Offline
      C Offline
      Covean
      wrote on last edited by
      #2

      The status is a flag value, what means every bit that is set has his own meaning. In your case 33 equals 0x21 (hex) equals 100001b (binary), what means the first and the sixth bits are set. Now if you look at th attributes: enum Attribute { normal = 0x00, readOnly = 0x01, hidden = 0x02, system = 0x04, volume = 0x08, directory = 0x10, archive = 0x20 }; You will see the 33 (0x21) means it is a readOnly and an archived file (0x01 + 0x20 == 0x21).

      Greetings Covean

      1 Reply Last reply
      0
      • R Rakesh5

        hi all, i am actually trying to load a readonly file into my application. i am using CFileStatus's Getstatus method to find out the value of dwFileAttributes value. i am getting the value as 33.. my doubt is, do we get this value as 33 for all readonly files?? but in msdn, its been given as 1 for readonly file.. thanks, rakesh.

        C Offline
        C Offline
        CPallini
        wrote on last edited by
        #3

        Rakesh5 wrote:

        my doubt is, do we get this value as 33 for all readonly files??

        Nope, according to ducomentation 33 means 'archive' AND 'read-only'. You should test the least significative bit of the m_attribute byte, in order to get the read-only property, for instance

        bool isReadOnly = (status.m_attribute & CFileStatus::Attribute.readOnly) == CFileStatus::Attribute.readOnly;

        :)

        If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
        This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
        [My articles]

        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