GetFileNames

 

Description

Get all the file names in a specified folder that match a specified file specification.

Syntax

int GetFileNames( StringArray & saFileNames, LPCSTR lpcszPath, LPCSTR lpcszFileSpec, DWORD dwCtrl )

Parameters

saFileNames
[output] names of found files
lpcszPath
[input]path to begin search, if NULL then User Files Folder is used
lpcszFileSpec
[input]files to look for, if NULL then *.* is used
dwCtrl
[input]control options, see GFIF_* bits

Return

Returns zero for success and non-zero for error.

Examples

EX1

void GetFileNames_ex1()
{
        StringArray saFiles;
        string strPath = GetAppPath(true) + "OriginC\\System\\";
        int nErr = GetFileNames(saFiles, strPath, "*.h", GFIF_FILE_RECURSIVE | GFIF_STRIP_START_PATH);
        out_str("Files find in this folder :");
        for ( int ii = 0; ii < saFiles.GetSize(); ii++ )
        {
                printf("%s\n", saFiles[ii]);
        }
}

Remark

See Also

header to Include

origin.h

Reference