将字符串转为16进制显示的字符串
CString ByteArrayToStr( BYTE* data, int len )
{
CString str = _T("");
BYTE* pData = data;
for ( int i = 0; i < len; i++ )
{
str.AppendFormat( _T("%02X "), pData[i] );
}
return str;
}
创建以“$MM”开头的临时文件
CString CreateTempFile()
{
TCHAR tempPath[MAX_PATH] = {0};
TCHAR szTempName[MAX_PATH];
DWORD pathLen = GetTempPath( MAX_PATH, tempPath );
if ( pathLen > MAX_PATH || ( pathLen == 0 ) )
{
AfxMessageBox( _T("GetTempPath failed in GetTempPath()!") );
}
::GetTempFileName(tempPath,_T("$MM"),0,szTempName);
return szTempName;
}
以当前时间做名称创建目录
void CreateTimeDir()
{
CTime time = CTime::GetCurrentTime();
CString strPath = _T("");
strPath = time.Format( _T("%Y_%m_%d_%H_%M_%S") );
_wmkdir((LPCTSTR)strPath);
}