• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2<html lang="en">
3<head>
4<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5<meta http-equiv="Content-Style-Type" content="text/css">
6<link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">
7<title>FatFs - f_chmod</title>
8</head>
9
10<body>
11
12<div class="para func">
13<h2>f_chmod</h2>
14<p>The f_chmod function changes the attribute of a file or sub-directory.</p>
15<pre>
16FRESULT f_chmod (
17  const TCHAR* <span class="arg">path</span>, <span class="c">/* [IN] Object name */</span>
18  BYTE <span class="arg">attr</span>,         <span class="c">/* [IN] Attribute flags */</span>
19  BYTE <span class="arg">mask</span>          <span class="c">/* [IN] Attribute masks */</span>
20);
21</pre>
22</div>
23
24<div class="para arg">
25<h4>Parameters</h4>
26<dl class="par">
27<dt>path</dt>
28<dd>Pointer to the null-terminated string that specifies an <a href="filename.html">object</a> to be changed</dd>
29<dt>attr</dt>
30<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>
31<table class="lst">
32<tr><th>Attribute</th><th>Description</th></tr>
33<tr><td>AM_RDO</td><td>Read only</td></tr>
34<tr><td>AM_ARC</td><td>Archive</td></tr>
35<tr><td>AM_SYS</td><td>System</td></tr>
36<tr><td>AM_HID</td><td>Hidden</td></tr>
37</table>
38</dd>
39<dt>mask</dt>
40<dd>Attribute mask that specifies which attribute is changed. The specified attributes are set or cleard and others are left unchanged.</dd>
41</dl>
42</div>
43
44
45<div class="para ret">
46<h4>Return Values</h4>
47<p>
48<a href="rc.html#ok">FR_OK</a>,
49<a href="rc.html#de">FR_DISK_ERR</a>,
50<a href="rc.html#ie">FR_INT_ERR</a>,
51<a href="rc.html#nr">FR_NOT_READY</a>,
52<a href="rc.html#ok">FR_NO_FILE</a>,
53<a href="rc.html#np">FR_NO_PATH</a>,
54<a href="rc.html#in">FR_INVALID_NAME</a>,
55<a href="rc.html#wp">FR_WRITE_PROTECTED</a>,
56<a href="rc.html#id">FR_INVALID_DRIVE</a>,
57<a href="rc.html#ne">FR_NOT_ENABLED</a>,
58<a href="rc.html#ns">FR_NO_FILESYSTEM</a>,
59<a href="rc.html#tm">FR_TIMEOUT</a>,
60<a href="rc.html#nc">FR_NOT_ENOUGH_CORE</a>
61</p>
62</div>
63
64
65<div class="para desc">
66<h4>Description</h4>
67<p>The <tt>f_chmod</tt> function changes the attribute of a file or sub-directory.</p>
68</div>
69
70
71<div class="para comp">
72<h4>QuickInfo</h4>
73<p>Available when <tt><a href="config.html#fs_readonly">FF_FS_READONLY</a> == 0</tt> and <tt><a href="config.html#use_chmod">FF_USE_CHMOD</a> == 1</tt>.</p>
74</div>
75
76
77<div class="para use">
78<h4>Example</h4>
79<pre>
80    <span class="c">/* Set Read-only, clear Archive and others are left unchanged. */</span>
81    <em>f_chmod</em>("file.txt", AM_RDO, AM_RDO | AM_ARC);
82</pre>
83</div>
84
85
86<p class="foot"><a href="../00index_e.html">Return</a></p>
87</body>
88</html>
89