setlabel.html 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 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 on the FAT volume is similar to the file name but there are some differences shown below:</p>
  46. <ul>
  47. <li>Spaces can be contained anywhere in the volume label. Trailing spaces are truncated off at FAT volume.</li>
  48. <li>Period is not allowed.</li>
  49. <li>Up to 11 bytes long as conversion of OEM code page at FAT volume.</li>
  50. <li>Up to 11 characters long at exFAT volume. Case information is preserved.</li>
  51. </ul>
  52. <p>Remark: The standard system (Windows) has a problem at handling of 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>
  53. </div>
  54. <div class="para comp">
  55. <h4>QuickInfo</h4>
  56. <p>Available when <tt>_FS_READONLY == 0</tt> and <tt>_USE_LABEL == 1</tt>.</p>
  57. </div>
  58. <div class="para use">
  59. <h4>Example</h4>
  60. <pre>
  61. <span class="c">/* Set volume label to the default drive */</span>
  62. f_setlabel("DATA DISK");
  63. <span class="c">/* Set volume label to the drive 2 */</span>
  64. f_setlabel("2:DISK 3 OF 4");
  65. <span class="c">/* Remove volume label of the drive 2 */</span>
  66. f_setlabel("2:");
  67. </pre>
  68. </div>
  69. <div class="para ref">
  70. <h4>See Also</h4>
  71. <tt><a href="getlabel.html">f_getlabel</a></tt>
  72. </div>
  73. <p class="foot"><a href="../00index_e.html">Return</a></p>
  74. </body>
  75. </html>