BOOL GetFullTempFileName(const TCHAR* strPrefix, std::wstring& strFullName) { TCHAR strTempFolder[MAX_PATH]; TCHAR strTempFileName[MAX_PATH]; DWORD dwRetVal = GetTempPath(MAX_PATH, // length of the buffer strTempFolder); // buffer for path if (dwRetVal > MAX_PATH || (dwRetVal == 0)) { return FALSE; } // Generates a temporary file name. UINT uRetVal = GetTempFileName(strTempFolder, // directory for tmp files strPrefix, // temp file name prefix 0, // create unique name strTempFileName); // buffer for name if (uRetVal == 0) { return FALSE; } //返回回去 strFullName = strTempFileName; return TRUE; }
Window下,在TEMP路径下生成一个临时文件名
猜你喜欢
转载自www.cnblogs.com/eaglexmw/p/11118546.html
今日推荐
周排行