What is the difference between passing the FILE_ATTRIBUTE_NORMAL
(0x80) and 0 to CreateFile function?
The CreateFile function can create a new file or open an existing file. You must specify the file name, creation instructions, and other attributes. When an application creates a new file, the operating system adds it to the specified directory.
File attributes are pieces of information associated with every file and directory that includes additional data about the file itself or its contents. They can exist in only one of two states – Set or Cleared; like an On or Off state. Attributes can be in files, directories, volumes and certain system objects.
File attributes are metadata values stored by the file system on disk and are used by the system and are available to developers via various file I/O APIs.
Which one of the following is not attributes of file? Explanation: rename is not the attribute of file rest all are files attributes.
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.
FILE_ATTRIBUTE_NORMAL
explicitly sets no attributes. If you pass 0, the set of attributes is unspecified.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With