2.1.10.13 FindFile


Description

Find a file in a given path. If lpSubFolder1st is given (not NULL), then A. if bExcluded = FALSE, then find this subfolder first, B. if bExcluded = TRUE, skip this subfolder

Syntax

BOOL FindFile( LPCTSTR lpcszName, LPSTR lpPath, LPCTSTR lpSubFolder1st = NULL, BOOL bExcluded = TRUE )

Parameters

lpcszName
[input] File name to search for.
lpPath
[input] on input, the starting path to search for a file. Output, to receive the full path of the file if found.
lpSubFolder1st
[input] Optional subfolder of the given path(lpPath) to search in.
bExcluded
whether to skip searching the subfolder (lpSubFolder1st) (FALSE to search it first)

Return

If the file is found then TRUE else FALSE.

Examples

EX1

void FindFile_ex1()
{
    char szTemp[MAXFULLPATH];
    lstrcpy(szTemp, GetAppPath());
    if(FindFile("origin.ini", szTemp, "Originlab", FALSE))
    {
        out_str("ok, found it");
        out_str(szTemp);
    }
    else
        out_str("Not found!");
}

Remark

See Also

Header to Include

origin.h

Reference