• 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_getlabel</title>
8</head>
9
10<body>
11
12<div class="para func">
13<h2>f_getlabel</h2>
14<p>The f_getlabel function returns volume label and volume serial number of a volume.</p>
15<pre>
16FRESULT f_getlabel (
17  const TCHAR* <span class="arg">path</span>,  <span class="c">/* [IN] Drive number */</span>
18  TCHAR* <span class="arg">label</span>,       <span class="c">/* [OUT] Volume label */</span>
19  DWORD* <span class="arg">vsn</span>          <span class="c">/* [OUT] Volume serial number */</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 the <a href="filename.html">logical drive</a>. Null-string specifies the default drive. If a null pointer is given, the function fails with <tt>FR_INVALID_DRIVE</tt>.</dd>
29<dt>label</dt>
30<dd>Pointer to the buffer to store the volume label. If the volume has no label, a null-string will be returned. Set null pointer if this information is not needed. The buffer size should be shown below at least to avoid buffer overflow.<br>
31<table class="lst2">
32<tr><td>Configuration</td><td>FF_FS_EXFAT == 0</td><td>FF_FS_EXFAT == 1</td></tr>
33<tr><td>FF_USE_LFN == 0</td><td>12 items</td><td>-</td></tr>
34<tr><td>FF_LFN_UNICODE == 0</td><td>12 items</td><td>23 items</td></tr>
35<tr><td>FF_LFN_UNICODE == 1,3</td><td>12 items</td><td>12 items</td></tr>
36<tr><td>FF_LFN_UNICODE == 2</td><td>34 items</td><td>34 items</td></tr>
37</table>
38</dd>
39<dt>vsn</dt>
40<dd>Pointer to the <tt>DWORD</tt> variable to store the volume serial number. Set null pointer if this information is not needed.</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#id">FR_INVALID_DRIVE</a>,
53<a href="rc.html#ne">FR_NOT_ENABLED</a>,
54<a href="rc.html#ns">FR_NO_FILESYSTEM</a>,
55<a href="rc.html#tm">FR_TIMEOUT</a>
56</p>
57</div>
58
59
60<div class="para comp">
61<h4>QuickInfo</h4>
62<p>Available when <tt><a href="config.html#use_label">FF_USE_LABEL</a> == 1</tt>.</p>
63</div>
64
65
66<div class="para use">
67<h4>Example</h4>
68<pre>
69    char str[12];
70
71    <span class="c">/* Get volume label of the default drive */</span>
72    <em>f_getlabel</em>("", str, 0);
73
74    <span class="c">/* Get volume label of the drive 2 */</span>
75    <em>f_getlabel</em>("2:", str, 0);
76</pre>
77</div>
78
79
80<div class="para ref">
81<h4>See Also</h4>
82<tt><a href="setlabel.html">f_setlabel</a></tt>
83</div>
84
85
86<p class="foot"><a href="../00index_e.html">Return</a></p>
87</body>
88</html>
89