Folder::IsValid

Description

Check if the folder object is valid

Syntax

BOOL IsValid( )

Parameters

Return

TRUE if folder is a valid object, otherwise FALSE

Examples

EX1

// Create some folder objects and verify that they are valid
void Folder_IsValid_Ex1()
{
    // Get the root folder
    Folder fldRoot("/");
    if (fldRoot.IsValid())
    {
        printf("The rootfolder is valid.\n");
        // Add a subfolder 
        Folder fldMyFolder = fldRoot.AddSubfolder("MyFolder");
        if (fldMyFolder.IsValid())
            // Note that name as actually created may not be the same as requested
            printf("The subfolder %s is valid.\n", fldMyFolder.GetName());
        else
            // Access to fldMyFolder would produce runtime error here
            printf("Could not attach to MyFolder\n");
    }
    else
        // Access to fldRoot would produce runtime error here
        printf("Could not attach to root folder\n");
}

Remark

Check if the folder object is valid. Must be used after creating a new folder object before attempting to access a method or property of the object to avoid a runtime error.

See Also

Folder::GetParent

header to Include

origin.h