FNFCIGETTEMPFILE macro (fci.h)

The FNFCIGETTEMPFILE macro provides the declaration for the application-defined callback function to obtain a temporary file name.

Syntax

void FNFCIGETTEMPFILE(
  [out]  fn
);

Parameters

[out] fn

Pointer to a buffer to receive the complete temporary file name.

Return value

None

Remarks

The function can return a filename that already exists by the time it is opened. For this reason, the caller should be prepared to make several attempts to create temporary files.

Examples

FNFCIGETTEMPFILE(fnGetTempFileName)
{
    BOOL bSucceeded = FALSE;
    CHAR pszTempPath[MAX_PATH];
    CHAR pszTempFile[MAX_PATH];

    UNREFERENCED_PARAMETER(pv);
    UNREFERENCED_PARAMETER(cbTempName);

    if( GetTempPathA(MAX_PATH, pszTempPath) != 0 )
    {
        if( GetTempFileNameA(pszTempPath, "CABINET", 0, pszTempFile) != 0 )
        {
            DeleteFileA(pszTempFile);
            bSucceeded = SUCCEEDED(StringCbCopyA(pszTempName, cbTempName, pszTempFile));
        }
    }

    return bSucceeded;
}

Requirements

Requirement Value
Target Platform Windows
Header fci.h

See also

FCICreate