File_ListFile(), String * 12
Result String = file name
0 = end of list
String * 12 = file name
Get Currently Listed File Name
File_ListFile() is a command used to retrieve the name of a file currently being processed in a sequential list of files. This is part of a system that allows you to loop through the files in the current folder (directory), listing their names one by one.
Example:
File_ListFile()
How It Works:
• File_ListFile() is used to get the name of the file at the current position in the list. After each call, the internal counter is incremented, which moves to the next file in the list.
• It returns a string with the file name. If there are no more files to list, it returns 0, signaling the end of the list.
Notes:
• End of List: When there are no more files to list, File_ListFile() will return 0.
• File Names: File names are returned in the order they appear in the FAT table (the file system's allocation table).
• File List Reset: You must call File_ListReset() before using File_ListFile() to ensure that you begin from the start of the file list.
TftSetUp(0) 'Set screen TftResetScreen(BLACK) 'Reset screen TftSetSndFont(0,0) 'Set Font0 While File_Init() <> cErrOK : Wend 'Initialize SD Card TftPrintSndString("Sd Initialization OK",1,0,0,1,GREEN,BLACK,0) 'Confirm Initialize SD Card bCounter = 27 'Vertical print counter File_ListReset() 'Reset file/folder counter Do Clear sString sString = File_ListDir() 'Loop through folder names If sString = 0 Then Break 'Break if end of list TftPrintSndString(sString,1,0,bCounter,1,GREEN,BLACK,0) 'Print folder name Dec bCounter 'Move to next print line Loop bCounter = 27 'Vertical print counter File_ListReset() 'Reset file/folder counter Do 'Loop through file names Clear sString sString = File_ListFile() If sString = 0 Then Break 'Break if end of list TftPrintSndString(sString,1,20,bCounter,1,WHITE,BLACK,0) 'Print folder name Dec bCounter 'Move to next print line Loop |
|
Created with the Personal Edition of HelpNDoc: Transform Your Word Document into a Professional eBook with HelpNDoc