zoukankan      html  css  js  c++  java
  • Window下,在TEMP路径下生成一个临时文件名

    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;
    }
  • 相关阅读:
    类和对象
    使用JAVA理解程序逻辑
    类的有参
    1.人机猜拳
    类的无参方法
    类和对象
    Java解析XML
    集合框架一
    Java中的包
    继承
  • 原文地址:https://www.cnblogs.com/eaglexmw/p/11118546.html
Copyright © 2011-2022 走看看