<p>The f_setlabel function sets/removes the label of a volume.</p>
<pre>
FRESULT f_setlabel (
const TCHAR* <spanclass="arg">label</span><spanclass="c">/* [IN] Volume label to be set */</span>
);
</pre>
</div>
<divclass="para arg">
<h4>Parameters</h4>
<dlclass="par">
<dt>label</dt>
<dd>Pointer to the null-terminated string that specifies the volume label to be set.</dd>
</dl>
</div>
<divclass="para ret">
<h4>Return Values</h4>
<p>
<ahref="rc.html#ok">FR_OK</a>,
<ahref="rc.html#de">FR_DISK_ERR</a>,
<ahref="rc.html#ie">FR_INT_ERR</a>,
<ahref="rc.html#nr">FR_NOT_READY</a>,
<ahref="rc.html#in">FR_INVALID_NAME</a>,
<ahref="rc.html#wp">FR_WRITE_PROTECTED</a>,
<ahref="rc.html#id">FR_INVALID_DRIVE</a>,
<ahref="rc.html#ne">FR_NOT_ENABLED</a>,
<ahref="rc.html#ns">FR_NO_FILESYSTEM</a>,
<ahref="rc.html#tm">FR_TIMEOUT</a>
</p>
</div>
<divclass="para desc">
<h4>Description</h4>
<p>When the string has a drive number, the volume label will be set to the volume specified by the drive number. If not, the label will be set to the default drive. If the given string is a null-string, the volume label on the volume will be removed. The format of the volume label is similar to the short file name but there are some differences shown below:</p>
<ul>
<li>11 bytes or less in length as local character code. LFN extention is not applied to the volume label.</li>
<li>Cannot contain period.</li>
<li>Can contain spaces anywhere in the volume label. Trailing spaces are truncated off.</li>
</ul>
</div>
<divclass="para comp">
<h4>QuickInfo</h4>
<p>Available when <tt>_FS_READONLY == 0</tt> and <tt>_USE_LABEL == 1</tt>.</p>
</div>
<divclass="para use">
<h4>Example</h4>
<pre>
<spanclass="c">/* Set volume label to the default drive */</span>
f_setlabel("DATA DISK");
<spanclass="c">/* Set volume label to the drive 2 */</span>
f_setlabel("2:DISK 3 OF 4");
<spanclass="c">/* Remove volume label of the drive 2 */</span>