GetFilenamesInFolder

 

Description

Search a windows folder adding any filenames that match a specified file filter to an output string. Options specify whether or not subfolders are to be recursively searched and whether or not path and file extension are to be included with file name.

Syntax

int GetFilenamesInFolder( string & strListOfFilenames, LPCSTR lpcstrPath = "", LPCSTR lpcstrFileFilter = "", BOOL bRecursive = FALSE, UINT wDisplayOptions = GFIF_FILE_WITH_PATH )

Parameters

strListOfFilenames
[output] list of formatted filenames found in folder
lpcstrPath
[input] path to start searching, default "" is path to Origin software folder
lpcstrFileFilter
[input] file filter which may include DOS wild card characters, default is "*.*"
bRecursive
[input] option to recursively search subfolders, default is FALSE
wDisplayOptions
[input] bitwise flag specifying display options, default value GFIF_FILE_WITH_PATH
displays path, filename and filetype, GFIF_FILE_NO_PATH displays filename and filetype without
path, GFIF_FILE_NO_EXT displays path and filename with out filetype extension, and
GFIF_FILE_NO_PATH | GFIF_FILE_NO_EXT displays file name without path or filetype extension

Return

Returns GFIF_NO_ERROR on success or an GFIF warning or error code on failure.

Examples

EX1

int GetFilenamesInFolder_ex1()
{
    string strTemplateFileList;
    GetFilenamesInFolder(strTemplateFileList, "", "*.otw", FALSE, 3);
    return 0;
}

Remark

See Also

header to Include

origin.h

Reference