File_Exists()

 visits
Parent Previous Next

Syntax

File_Exists(pFileName), Bit

Overview

pFileName: The name of the file to check (maximum length 12 characters, including the dot and extension).

Return status

Value

Meaning

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

Example

File_Exists("Cat.bmp")

TftSetUp(0, 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

File_Exists()File_Exists()

Created with the Personal Edition of HelpNDoc: Generate EPub eBooks with ease