File_Exists(pFileName), Bit
pFileName: The name of the file to check (maximum length 12 characters, including the dot and extension).
Return Status:
0: File not found.
1: File found.
Check if File Exists
This procedure checks whether a file with the given name exists. The file name can be up to 12 characters in length, including the dot and file extension.
Notes:
• Before checking for other files or folders, ensure that any previously opened files are closed using File_Close().
Example:
File_Exists("Cat.bmp")
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 If File_Exists("bird.jpg") = 1 Then TftPrintSndString("Exist bird.jpg OK",1,0,4,1,GREEN,BLACK,0) 'bird.jpg exists (expected) Else TftPrintSndString("Exist bird.jpg NO",1,0,4,1,GREEN,BLACK,0) 'bird.jpg not exists EndIf If File_Exists("test.log") = 1 Then TftPrintSndString("Exist test.Log OK",1,0,5,1,GREEN,BLACK,0) 'test.Log exists Else TftPrintSndString("Exist test.Log NO",1,0,5,1,GREEN,BLACK,0) 'test.Log not exists (expected) EndIf If File_DirExists("home") = 1 Then TftPrintSndString("Exist home OK",1,0,2,1,GREEN,BLACK,0) 'home folder exists (expected) Else TftPrintSndString("Exist home NO",1,0,2,1,GREEN,BLACK,0) 'home folder not exists EndIf If File_DirExists("tree") = 1 Then TftPrintSndString("Exist tree OK",1,0,3,1,GREEN,BLACK,0) 'tree folder exists Else TftPrintSndString("Exist tree NO",1,0,3,1,GREEN,BLACK,0) 'tree folder not exists (expected) EndIf |
|
Created with the Personal Edition of HelpNDoc: Quickly and Easily Convert Your Word Document to an ePub or Kindle eBook