1e6865dcdSopenharmony_ci<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
2e6865dcdSopenharmony_ci<html lang="en">
3e6865dcdSopenharmony_ci<head>
4e6865dcdSopenharmony_ci<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
5e6865dcdSopenharmony_ci<meta http-equiv="Content-Style-Type" content="text/css">
6e6865dcdSopenharmony_ci<link rel="up" title="FatFs" href="../00index_e.html">
7e6865dcdSopenharmony_ci<link rel="alternate" hreflang="ja" title="Japanese" href="../ja/setlabel.html">
8e6865dcdSopenharmony_ci<link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">
9e6865dcdSopenharmony_ci<title>FatFs - f_setlabel</title>
10e6865dcdSopenharmony_ci</head>
11e6865dcdSopenharmony_ci
12e6865dcdSopenharmony_ci<body>
13e6865dcdSopenharmony_ci
14e6865dcdSopenharmony_ci<div class="para func">
15e6865dcdSopenharmony_ci<h2>f_setlabel</h2>
16e6865dcdSopenharmony_ci<p>The f_setlabel function sets/removes the label of a volume.</p>
17e6865dcdSopenharmony_ci<pre>
18e6865dcdSopenharmony_ciFRESULT f_setlabel (
19e6865dcdSopenharmony_ci  const TCHAR* <span class="arg">label</span>  <span class="c">/* [IN] Volume label to be set */</span>
20e6865dcdSopenharmony_ci);
21e6865dcdSopenharmony_ci</pre>
22e6865dcdSopenharmony_ci</div>
23e6865dcdSopenharmony_ci
24e6865dcdSopenharmony_ci<div class="para arg">
25e6865dcdSopenharmony_ci<h4>Parameters</h4>
26e6865dcdSopenharmony_ci<dl class="par">
27e6865dcdSopenharmony_ci<dt>label</dt>
28e6865dcdSopenharmony_ci<dd>Pointer to the null-terminated string that specifies the volume label to be set.</dd>
29e6865dcdSopenharmony_ci</dl>
30e6865dcdSopenharmony_ci</div>
31e6865dcdSopenharmony_ci
32e6865dcdSopenharmony_ci
33e6865dcdSopenharmony_ci<div class="para ret">
34e6865dcdSopenharmony_ci<h4>Return Values</h4>
35e6865dcdSopenharmony_ci<p>
36e6865dcdSopenharmony_ci<a href="rc.html#ok">FR_OK</a>,
37e6865dcdSopenharmony_ci<a href="rc.html#de">FR_DISK_ERR</a>,
38e6865dcdSopenharmony_ci<a href="rc.html#ie">FR_INT_ERR</a>,
39e6865dcdSopenharmony_ci<a href="rc.html#nr">FR_NOT_READY</a>,
40e6865dcdSopenharmony_ci<a href="rc.html#in">FR_INVALID_NAME</a>,
41e6865dcdSopenharmony_ci<a href="rc.html#wp">FR_WRITE_PROTECTED</a>,
42e6865dcdSopenharmony_ci<a href="rc.html#id">FR_INVALID_DRIVE</a>,
43e6865dcdSopenharmony_ci<a href="rc.html#ne">FR_NOT_ENABLED</a>,
44e6865dcdSopenharmony_ci<a href="rc.html#ns">FR_NO_FILESYSTEM</a>,
45e6865dcdSopenharmony_ci<a href="rc.html#tm">FR_TIMEOUT</a>
46e6865dcdSopenharmony_ci</p>
47e6865dcdSopenharmony_ci</div>
48e6865dcdSopenharmony_ci
49e6865dcdSopenharmony_ci
50e6865dcdSopenharmony_ci<div class="para desc">
51e6865dcdSopenharmony_ci<h4>Description</h4>
52e6865dcdSopenharmony_ci<p>When the string has a drive prefix, the volume label will be set to the volume specified by the drive prefix. Unix style volume ID cannot be used to specify the volume. If drive number is not specified, the volume label will be set to the default drive. If length of the given volume label is zero, the volume label on the volume will be removed. The format of the volume label is as shown below:</p>
53e6865dcdSopenharmony_ci<ul>
54e6865dcdSopenharmony_ci<li>Up to 11 bytes long as conversion of OEM code page at FAT volume.</li>
55e6865dcdSopenharmony_ci<li>Up to 11 characters long at exFAT volume.</li>
56e6865dcdSopenharmony_ci<li>Allowable characters for FAT volume are: characters allowed for SFN excludes dot. Low-case characters are up converted.</li>
57e6865dcdSopenharmony_ci<li>Allowable characters for exFAT volume are: characters allowed for LFN includes dot. Low-case characters are preserved.</li>
58e6865dcdSopenharmony_ci<li>Spaces can be embedded anywhere in the volume label. Trailing spaces are truncated off at FAT volume.</li>
59e6865dcdSopenharmony_ci</ul>
60e6865dcdSopenharmony_ci<p>Remark: The standard system (Windows) has a problem at the volume label with a heading <tt>\xE5</tt> on the FAT volume. To avoid this problem, this function rejects such volume label as invalid name.</p>
61e6865dcdSopenharmony_ci</div>
62e6865dcdSopenharmony_ci
63e6865dcdSopenharmony_ci<div class="para comp">
64e6865dcdSopenharmony_ci<h4>QuickInfo</h4>
65e6865dcdSopenharmony_ci<p>Available when <tt><a href="config.html#fs_readonly">FF_FS_READONLY</a> == 0</tt> and <tt><a href="config.html#use_label">FF_USE_LABEL</a> == 1</tt>.</p>
66e6865dcdSopenharmony_ci</div>
67e6865dcdSopenharmony_ci
68e6865dcdSopenharmony_ci
69e6865dcdSopenharmony_ci<div class="para use">
70e6865dcdSopenharmony_ci<h4>Example</h4>
71e6865dcdSopenharmony_ci<pre>
72e6865dcdSopenharmony_ci    <span class="c">/* Set volume label to the default drive */</span>
73e6865dcdSopenharmony_ci    <em>f_setlabel</em>("DATA DISK");
74e6865dcdSopenharmony_ci
75e6865dcdSopenharmony_ci    <span class="c">/* Set volume label to the drive 2 */</span>
76e6865dcdSopenharmony_ci    <em>f_setlabel</em>("2:DISK 3 OF 4");
77e6865dcdSopenharmony_ci
78e6865dcdSopenharmony_ci    <span class="c">/* Remove volume label of the drive 2 */</span>
79e6865dcdSopenharmony_ci    <em>f_setlabel</em>("2:");
80e6865dcdSopenharmony_ci</pre>
81e6865dcdSopenharmony_ci</div>
82e6865dcdSopenharmony_ci
83e6865dcdSopenharmony_ci
84e6865dcdSopenharmony_ci<div class="para ref">
85e6865dcdSopenharmony_ci<h4>See Also</h4>
86e6865dcdSopenharmony_ci<tt><a href="getlabel.html">f_getlabel</a></tt>
87e6865dcdSopenharmony_ci</div>
88e6865dcdSopenharmony_ci
89e6865dcdSopenharmony_ci
90e6865dcdSopenharmony_ci<p class="foot"><a href="../00index_e.html">Return</a></p>
91e6865dcdSopenharmony_ci</body>
92e6865dcdSopenharmony_ci</html>
93