c++windowswinapifile-io

What is the difference between FILE_ATTRIBUTE_NORMAL and 0?


What is the difference between passing the FILE_ATTRIBUTE_NORMAL (0x80) and 0 to CreateFile function?


Solution

  • From the MSDN page for CreateFile():

    Note When CreateFile opens an existing file, it generally combines the file flags with the file attributes of the existing file, and ignores any file attributes supplied as part of dwFlagsAndAttributes.

    Or to put it another way, you want a value that means "I don't care" when you open an existing file. Because the operating system doesn't care. That value is 0.