16,473
社区成员
发帖
与我相关
我的任务
分享
CTime t = CTime::GetCurrentTime();
CString tm = t.Format("'%Y/%m/%d-%H/%M/%S'");
tm =tm + ".ini";
COPini::WriteString("配置信息", "厚度", P[0],tm)//tm的参数类型为char *;
CTime t = CTime::GetCurrentTime();
CString tm = t.Format("'%Y/%m/%d-%H/%M/%S'");
tm =tm + ".ini";
CString time(tm);
char *pvalue =(LPTSTR)(LPCTSTR)tm;
COPini::WriteString("配置信息", "厚度", P[0],pvalue)
int n = MultiByteToWideChar(CP_ACP,0,ac,-1,NULL,0);//ac是你要转换的char*
wchar_t* buff = new wchar_t[n];
wmemset(buff,0,n);
MultiByteToWideChar(CP_ACP,0,ac,-1,buff,n);
CString strRet = buff;//strRet即为转换完毕的CString
另,文件名中是不允许有/ \ ?之类的CTime t = CTime::GetCurrentTime();
char szPath[MAX_PATH] = {0};
StringCchPrintfA(szPath, _countof(szPath), "%04d%02d%02d-%02d%02d%02d", t.GetYear(), t.GetMonth(), t.GetDay(), t.GetHour(), t.GetMinute(), t.GetSecond());
COPini::WriteString("配置信息", "厚度", P[0], szPath)
t.Format("'%Y/%m/%d-%H/%M/%S'"); '‘/' 改 ‘_'
_T(tm)就好了,不要加双引号
你的字符串需要用_T("xxx"), TEXT("xxx")包含起来
WideCharToMultiByte(CP_ACP, ...); 或者USES_CONVERSION; T2A()
你的字符串需要用_T("xxx"), TEXT("xxx")包含起来