1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
\r
4 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
\r
5 <meta http-equiv="Content-Style-Type" content="text/css">
\r
6 <link rel="up" title="FatFs" href="../00index_e.html">
\r
7 <link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">
\r
8 <title>FatFs - f_chmod</title>
\r
15 <p>The f_chmod function changes the attribute of a file or directory.</p>
\r
18 const char* <em>FileName</em>, /* Pointer to the file or directory */
\r
19 BYTE <em>Attribute</em>, /* Attribute flags */
\r
20 BYTE <em>AttributeMask</em> /* Attribute masks */
\r
29 <dd>Pointer to the null-terminated string that specifies a <a href="filename.html">file or directory</a> to be changed</dd>
\r
31 <dd>Attribute flags to be set in one or more combination of the following flags. The specified flags are set and others are cleard.<br>
\r
33 <tr><th>Attribute</th><th>Description</th></tr>
\r
34 <tr><td>AM_RDO</td><td>Read only</td></tr>
\r
35 <tr><td>AM_ARC</td><td>Archive</td></tr>
\r
36 <tr><td>AM_SYS</td><td>System</td></tr>
\r
37 <tr><td>AM_HID</td><td>Hidden</td></tr>
\r
40 <dt>AttributeMask</dt>
\r
41 <dd>Attribute mask that specifies which attribute is changed. The specified aattributes are set or cleard.</dd>
\r
47 <h4>Return Values</h4>
\r
50 <dd>The function succeeded.</dd>
\r
52 <dd>Could not find the file.</dd>
\r
54 <dd>Could not find the path.</dd>
\r
55 <dt>FR_INVALID_NAME</dt>
\r
56 <dd>The file name is invalid.</dd>
\r
57 <dt>FR_INVALID_DRIVE</dt>
\r
58 <dd>The drive number is invalid.</dd>
\r
59 <dt>FR_NOT_READY</dt>
\r
60 <dd>The disk drive cannot work due to no medium in the drive or any other reason.</dd>
\r
61 <dt>FR_WRITE_PROTECTED</dt>
\r
62 <dd>The medium is write protected.</dd>
\r
63 <dt>FR_DISK_ERR</dt>
\r
64 <dd>The function failed due to an error in the disk function.</dd>
\r
66 <dd>The function failed due to a wrong FAT structure or an internal error.</dd>
\r
67 <dt>FR_NOT_ENABLED</dt>
\r
68 <dd>The logical drive has no work area.</dd>
\r
69 <dt>FR_NO_FILESYSTEM</dt>
\r
70 <dd>There is no valid FAT partition on the disk.</dd>
\r
76 <h4>Description</h4>
\r
77 <p>The f_chmod function changes the attribute of a file or directory. This function is not available in read-only configuration and minimization level of >=1.</p>
\r
84 // Set read-only flag, clear archive flag and others are retained.
\r
85 f_chmod("file.txt", AR_RDO, AR_RDO | AR_ARC);
\r
89 <p class="foot"><a href="../00index_e.html">Return</a></p>
\r