get_next_file_name

 

Description

Check to find the filename that does not already exist

Syntax

bool get_next_file_name( string & strFilename, bool bCheckCreatePath = true, bool bKeepPostfixFormat = true )

Parameters

strFilename
[modify] filename to check and update if needed
bCheckCreatePath
[input] if path dose not existed, to create or just return false
bKeepPostfixFormat
[input]for true, if strFilename is Page001, then the next filename shuold keep the formst of postfix, like Page002.

Return

true if strFilename is a good new file name that is not in conflict with existing files

Examples

EX1

int get_next_file_name_ex1()
{
    string str = GetAppPath() + "origin.ini";
    bool bRet = get_next_file_name(str);
    ASSERT(bRet);
    string strOld = GetAppPath() + "origin.ini";
    ASSERT(strOld != str);// since origin.ini must already existed
    return 0;
}

Remark

See Also

header to Include

origin.h

Reference