f_getlabel

The f_getlabel function returns volume label and volume serial number of a volume.

FRESULT f_getlabel (
  const TCHAR* path,  /* [IN] Drive number */
  TCHAR* label,       /* [OUT] Volume label */
  DWORD* vsn          /* [OUT] Volume serial number */
);

Parameters

path
Pointer to the null-terminated string that specifies the logical drive. Null-string specifies the default drive.
label
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.
ConfigurationFF_FS_EXFAT == 0FF_FS_EXFAT == 1
FF_USE_LFN == 012 items-
FF_LFN_UNICODE == 012 items23 items
FF_LFN_UNICODE == 1/312 items12 items
FF_LFN_UNICODE == 234 items34 items
vsn
Pointer to the DWORD variable to store the volume serial number. Set null pointer if this information is not needed.

Return Values

FR_OK, FR_DISK_ERR, FR_INT_ERR, FR_NOT_READY, FR_INVALID_DRIVE, FR_NOT_ENABLED, FR_NO_FILESYSTEM, FR_TIMEOUT

QuickInfo

Available when FF_USE_LABEL == 1.

Example

    char str[12];

    /* Get volume label of the default drive */
    f_getlabel("", str, 0);

    /* Get volume label of the drive 2 */
    f_getlabel("2:", str, 0);

See Also

f_setlabel

Return