Folder::GetName

Description

Get the name of a folder


Return the name of a folder to a string reference

Syntax

string GetName( )

BOOL GetName( string & strName )

Parameters

strName
[output] String to receive folder name

Return

Returns the name of a folder to a string


TRUE on success, FALSE if the folder is not valid.

Examples

EX1

// Try to create two subfolders of root using the same name
// Illustrates getting actual name of folder which was created
void Folder_GetName_Ex1()
{
    Folder fldRoot("/");
    Folder fldMyFolder();
    fldMyFolder = fldRoot.AddSubfolder("MyFolder");
    if( fldMyFolder.IsValid() )
    {
        string strCurrFld = fldMyFolder.GetName();
        printf("The folder name is \"%s\"\n", strCurrFld);
    }
    else
        printf("Problem in creation of /MyFolder\n");
    fldMyFolder = fldRoot.AddSubfolder("MyFolder");
    if( fldMyFolder.IsValid() )
    {
        string strCurrFld = fldMyFolder.GetName();
        printf("The folder name is \"%s\"\n", strCurrFld);
    }
    else
        printf("Problem in creation of /MyFolder\n");
}


EX2

// Another method of getting a folder name using a string reference
void    Folder_GetName_Ex2()
{
    Folder fld = Project.ActiveFolder();
    string strName;
    if( fld.GetName(strName) )
        printf("Current folder is: %s", strName);
}

Remark

Get the name of the folder.

See Also

header to Include

origin.h