C_GetRestartParentFileNames

Call C_GetRestartParentFileNames to obtain the full chain of parent file names for a restart analysis model.

void C_GetRestartParentFileNames(

TOrcFxAPIHandle ModelHandle,

TOrcFxAPIHandle *lpBufferHandle,

int64_t *lpBufferLen,

int *lpStatus

);

Parameters

ModelHandle (IN)

The handle of the model.

lpBufferHandle (OUT)

Points to a variable in which a handle to the buffer containing the parent file name will be returned.

lpBufferLen (OUT)

Points to a variable in which the length of the buffer containing the parent file name will be returned.

lpStatus (OUT)

Points to a variable in which the status result for the function call will be returned.

Remarks

The parent file names are returned as a double null-terminated list of strings.

In order to extract the contents of the buffer, you must follow the call to C_GetRestartParentFileNames with calls to C_CopyBuffer and C_FreeBuffer. Use the value returned in lpBufferLen to allocate a suitably sized buffer. Pass this to C_CopyBuffer to perform the copy. Finally, call C_FreeBuffer to free the buffer handle.

Such code typically looks like this:

TOrcFxAPIHandle BufferHandle;

int64_t BufferLen;

int Status;

C_GetRestartParentFileNamesW(ModelHandle, &BufferHandle, &BufferLen, &Status);

std::vector<wchar_t> fileNameBuffer(BufferLen / sizeof(wchar_t));

C_CopyBuffer(BufferHandle, reinterpret_cast<unsigned char*>(&fileNameBuffer[0]), BufferLen, &Status);

C_FreeBuffer(BufferHandle, &Status);

std::vector<std::wstring> parentFileNames;

for (const wchar_t *pszz = &fileNameBuffer[0]; *pszz; pszz += wcslen(pszz) + 1)

parentFileNames.push_back(pszz);

Note that, for the sake of brevity, error checking has been omitted from the above code.

Unicode and ANSI

The Unicode function name is C_GetRestartParentFileNamesW and the ANSI function name is C_GetRestartParentFileNamesA.

See also

C_CopyBuffer, C_FreeBuffer, C_GetRestartParentFileName.