83Plus:Software:usb8x/Asm Interface/MSD/DOS getDirEntry
From WikiTI
Synopsis
Name: DOS_getDirEntry
Minimum usb8x version: 0.10
Gets directory entry for a specified file/folder. A directory entry is useful for certain functions such as DOS_getFileSize.
Inputs
- HL is the stating cluster of a directory (obtained with [[../FAT_getStartingCluster|FAT_getStartingCluster]])
- BC is the entry number of a file
Outputs
- HL points to the directory entry of the file/directory
- C set if problems
Destroys
- AF, BC, DE, HL
Notes
This works with both file and folder names. It also works especially well with DOS_getNextFile. This function is useful if you need to get the directory entry for a file just found with [[../DOS_getNextFile|DOS_getNextFile]].
Example code to get directory entry for first file in the root directory:
ld hl,sDirectory U_CALL FAT_getStartingCluster ld bc,-1 U_CALL DOS_getDirEntry ... sDirectory: DB "/",0
If you are writing an application, you must copy the strings you use to RAM first, or else usb8x will not be able to see them.
See Also
- [[../FAT_lookupPath|FAT_lookupPath]] - Find whether specified file/directory exists
- [[../DOS_getNextFile|DOS_getNextFile]] - Get first/next file in a specified directory