我有時間在char[]
格式,但我需要將其轉換爲CString
。下面是我有什麼,但它不工作:char []到CString轉換
GetSystemTime(&t);
char time[60] = "";
char y[20],mon[20],d[20],h[20],min[20],s[20];
sprintf(y, "%d", t.wYear);
sprintf(d, "%d", t.wDay);
sprintf(mon, "%d", t.wMonth);
sprintf(h, "%d", t.wHour+5);
sprintf(min, "%d", t.wMinute);
sprintf(s, "%d", t.wSecond);
strcat(time,d);
strcat(time,"/");
strcat(time, mon);
strcat(time,"/");
strcat(time, y);
strcat(time," ");
strcat(time,h);
strcat(time,":");
strcat(time, min);
strcat(time,":");
strcat(time, s);
CString m_strFileName = time;
任何幫助.. :(
「它不工作」是非常模糊的。你有編譯錯誤嗎?它會崩潰嗎?結果是否錯誤? – molbdnilo