f_chmod

The f_chmod changes the attribute of a file or directory.

FRESULT f_chmod (
  const char* FileName, // Pointer to the file or directory
  BYTE Attribute,       // Attribute flags
  BYTE AttributeMask    // Attribute masks
);

Parameter

FileName
Pointer to the null-terminated string that specifies a file or directory to be changed
Attribute
Attribute flags to be set in one or more combination of the following flags. The specified flags are set and others are cleard.
AttributeDescription
AR_RDORead only
AR_ARCArchive
AR_SYSSystem
AR_HIDHidden
AttributeMask
Attribute mask that specifies which attribute is changed. The specified aattributes are set or cleard.

Return Values

FR_OK
The function succeeded.
FR_NOFILE
Could not find the file.
FR_NOPATH
Could not find the path.
FR_INVALID_NAME
The file name is invalid.
FR_NOT_READY
The disk drive cannot work due to no medium in the drive or any other reason.
FR_WRITE_PROTECTED
The medium is in write protected.
FR_RW_ERROR
Any error occured in low level disk I/O.
FR_INCORRECT_DISK_CHANGE
Incorrect disk removal, such as a medium change during any file is opend, has been occured.
FR_NOT_ENABLED
FatFs module has not been enabled.
FR_NO_FILESYSTEM
There is no valid FAT partition on the disk.

Description

The f_chmod changes the attribute of a file or directory. This function is not supported in read-only configuration.

Sample Code

    // Set read-only flag, clear archive flag and others are not changed.
    f_chmod("/file.txt", AR_RDO, AR_RDO | AR_ARC);

Return