There isn't any Win32 API to generate temporary files with any extension, so I wrote my own function:
BOOL GetTemporaryFilePath(CString strExtension, CString& strFileName)
{
TCHAR lpszTempPath[MAX_PATH] = { 0 };
if (!GetTempPath(MAX_PATH, lpszTempPath))
return FALSE;
TCHAR lpszFilePath[MAX_PATH] = { 0 };
do {
if (!GetTempFileName(lpszTempPath, NULL, 0, lpszFilePath))
return FALSE;
strFileName = lpszFilePath;
VERIFY(::DeleteFile(strFileName));
strFileName.Replace(_T(".tmp"), strExtension);
}
while (_taccess(strFileName, 00) != -1);
OutputDebugString(_T("GetTemporaryFilePath = '") + strFileName + _T("'\n"));
return TRUE;
}
My professional background includes knowledge of analyst programmer for Microsoft Visual C++, Microsoft Visual C#, Microsoft Visual Basic, Sun Java, assembly for Intel 80x86 microprocessors, assembly for PIC microcontrollers (produced by Microchip Inc.), relational databases (MySQL, Oracle, SQL Server), concurrent version systems, bug tracking systems, web design (HTML5, CSS3, XML, PHP/MySQL, JavaScript).