setlabel.html 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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=ISO-8859-1">
  5. <meta http-equiv="Content-Style-Type" content="text/css">
  6. <link rel="up" title="FatFs" href="../00index_e.html">
  7. <link rel="alternate" hreflang="ja" title="Japanese" href="../ja/setlabel.html">
  8. <link rel="stylesheet" href="../css_e.css" type="text/css" media="screen" title="ELM Default">
  9. <title>FatFs - f_setlabel</title>
  10. </head>
  11. <body>
  12. <div class="para func">
  13. <h2>f_setlabel</h2>
  14. <p>The f_setlabel function sets/removes the label of a volume.</p>
  15. <pre>
  16. FRESULT f_setlabel (
  17. const TCHAR* <span class="arg">label</span> <span class="c">/* [IN] Volume label to be set */</span>
  18. );
  19. </pre>
  20. </div>
  21. <div class="para arg">
  22. <h4>Parameters</h4>
  23. <dl class="par">
  24. <dt>label</dt>
  25. <dd>Pointer to the null-terminated string that specifies the volume label to be set.</dd>
  26. </dl>
  27. </div>
  28. <div class="para ret">
  29. <h4>Return Values</h4>
  30. <p>
  31. <a href="rc.html#ok">FR_OK</a>,
  32. <a href="rc.html#de">FR_DISK_ERR</a>,
  33. <a href="rc.html#ie">FR_INT_ERR</a>,
  34. <a href="rc.html#nr">FR_NOT_READY</a>,
  35. <a href="rc.html#in">FR_INVALID_NAME</a>,
  36. <a href="rc.html#wp">FR_WRITE_PROTECTED</a>,
  37. <a href="rc.html#id">FR_INVALID_DRIVE</a>,
  38. <a href="rc.html#ne">FR_NOT_ENABLED</a>,
  39. <a href="rc.html#ns">FR_NO_FILESYSTEM</a>,
  40. <a href="rc.html#tm">FR_TIMEOUT</a>
  41. </p>
  42. </div>
  43. <div class="para desc">
  44. <h4>Description</h4>
  45. <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>
  46. <ul>
  47. <li>11 bytes or less in length as local character code. LFN extention is not applied to the volume label.</li>
  48. <li>Cannot contain period.</li>
  49. <li>Can contain spaces anywhere in the volume label. Trailing spaces are truncated off.</li>
  50. </ul>
  51. </div>
  52. <div class="para comp">
  53. <h4>QuickInfo</h4>
  54. <p>Available when <tt>_FS_READONLY == 0</tt> and <tt>_USE_LABEL == 1</tt>.</p>
  55. </div>
  56. <div class="para use">
  57. <h4>Example</h4>
  58. <pre>
  59. <span class="c">/* Set volume label to the default drive */</span>
  60. f_setlabel("DATA DISK");
  61. <span class="c">/* Set volume label to the drive 2 */</span>
  62. f_setlabel("2:DISK 3 OF 4");
  63. <span class="c">/* Remove volume label of the drive 2 */</span>
  64. f_setlabel("2:");
  65. </pre>
  66. </div>
  67. <div class="para ref">
  68. <h4>See Also</h4>
  69. <tt><a href="getlabel.html">f_getlabel</a></tt>
  70. </div>
  71. <p class="foot"><a href="../00index_e.html">Return</a></p>
  72. </body>
  73. </html>