FNFCIGETTEMPFILE macro
The FNFCIGETTEMPFILE macro provides the declaration for the application-defined callback function to obtain a temporary file name.
Syntax
BOOL FNFCIGETTEMPFILE( [out] char *pszTempName[bcount(cbTempName)], [in] int cbTempName[range(>=, MAX_PATH)], void FAR *pv );
Parameters
- pszTempName [out]
-
Pointer to a buffer to receive the complete temporary file name.
- cbTempName [in]
-
Size, in bytes, of the pszTempName buffer.
- pv
-
Pointer to an application-defined value.
Return value
The indicated callback function returns TRUE if successful; otherwise FALSE.
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
|
Header |
|
|---|
See also