Skip to content

IGR_Subfiles_Close

IGR_Subfiles_Close releases the resources associated with an enumeration generated by IGR_Get_Subfiles_Enumerator or a similar function. It is imperative to free enumerators before closing the owning document.

Prototype

IGR_RETURN_CODE IGR_Subfiles_Close(
    HSUBFILES handle, 
    Error_Control_Block* error);

Parameters

enumerator: HSUBFILES

Handle to an enumerator opened by IGR_Get_Subfiles_Enumerator.

error: Pointer to Error_Control_Block

Returns error details if the call fails.

Return value

Success: IGR_LONG

Returns IGR_OK.

Failure: IGR_LONG

Returns one of the possible IGR_E error codes.

Sample code

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
Error_Control_Block error;
HSUBFILES subs;
std::array<IGR_UCS2, 4096> id;
std::array<IGR_UCS2, 1024> name;
IGR_LONGLONG date, size;
IGR_RETURN_CODE res;

if ((res = IGR_Get_Subfiles_Enumerator(docHandle, &subs, &error)) == IGR_OK)
{
    while ((res = IGR_Subfiles_Next(subs, &id[0], &name[0], &date, &size, &error)) == IGR_OK)
    {
        res = IGR_Extract_Subfile(docHandle, id, _UCS2("TEMP.DAT"), &error);
        if (res != IGR_OK)
            // ReportError(res);
        else
            // DoSomethingWithTheFile("TEMP.DAT", id, name);
    }
    IGR_Subfiles_Close(subs, &error);
}

See Also