File_GetFileExt()

Parent Previous Next

Syntax

File_GetFileExt(pExtension As String * 3), sSdTempName1

Parameters

pExtension — 3 character string extension to look for


Return value — File name as string

       

Returns the next file with selected extension


Returns the next file whose extension matches pExtension (without the dot, e.g. "BMP" - pad to 3 characters with trailing spaces for shorter extensions, matching FAT's 8.3 short-name format), or an empty string once there are no more matches.


Call File_ListReset() first, then call this repeatedly (same pattern as File_ListFile()).


Check result's byte 0 whether to exit e.g.: sTemp = File_GetFileExt("txt") : If sTemp[0] = 0 Then Break ...

Example

    Dim sTemp As String * 13

    Dim bTemp As Byte

    bTemp = 0 : File_ListReset()                            'Reset counters and file list

    Do

        sTemp = File_GetFileExt("txt")                      'Get next file with txt extension

        If sTemp[0] = 0 Then Break                          'Break loop if no more files

        TftPrintSndString(sTemp,1,0,bTemp,1,RED,BLACK,0)    'Print file

        Inc bTemp                                           'Increment print row counter    

    Loop

Created with the Personal Edition of HelpNDoc: Streamline Your CHM Help File Creation with HelpNDoc