一杯清酒邀明月
天下本无事,庸人扰之而烦耳。
posts - 3121,comments - 209,views - 578万
复制代码
 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   一杯清酒邀明月  阅读(726)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全网最简单!3分钟用满血DeepSeek R1开发一款AI智能客服,零代码轻松接入微信、公众号、小程
· .NET 10 首个预览版发布,跨平台开发与性能全面提升
· 《HelloGitHub》第 107 期
· 全程使用 AI 从 0 到 1 写了个小工具
· 从文本到图像:SSE 如何助力 AI 内容实时呈现?(Typescript篇)
历史上的今天:
2020-08-17 Qt 自定义QGraphicsItem
2020-08-17 Qt 视图框架QGraphicsItem
2020-08-17 Qt QGraphicsItem要点 积累
2020-08-17 Qt Q_UNUSED() 方法的使用
2020-08-17 Qt 绘图之QGraphicsScene QGraphicsView QGraphicsItem详解
2020-08-17 Qt 使用QGraphicsItem绘制复杂的图形
2020-08-17 Windows安装Python(图解)
< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

点击右上角即可分享
微信分享提示