一杯清酒邀明月
天下本无事,庸人扰之而烦耳。
 1 Do this,
 2 
 3 wchar_t clone[260];
 4 
 5 wcscpy(clone,szPath);
 6 
 7 Or, if you want to allocate memory yourself,
 8 
 9 wchar_t *clone = new wchar_t[wcslen(szPath)+1];
10 
11 wcscpy(clone,szPath);
12 
13 //use it
14 
15 delete []clone;
16 
17 Check out : strcpy, wcscpy, _mbscpy at MSDN
18 
19 However, if your implementation doesn't necessarily require raw pointers/array, then you should prefer this,
20 
21 #include<string>
22 
23 
24 //MOST SAFE!
25 
26 std:wstring clone(szPath);

 

posted on 2022-08-17 16:53  一杯清酒邀明月  阅读(716)  评论(0编辑  收藏  举报