VC2008 CString中0x00问题

xmxjh 2009-03-05 10:14:15
char strData[128]={0x00,0x11,0x22,....};
CString strtmp;

strtmp.Append(strData,5);

这样在VC2003中 strtmp.Getlenght() 为5,而在VC2008中strtmp.GetLength()就为0了!

昨天刚装的2008,请教下在2008中如何使得strtmp.GetLength()为5呢?
...全文
110 2 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
xmxjh 2009-03-05
  • 打赏
  • 举报
回复
谢谢 hdt 的回复,用 TCHAR 也是不行。
刚用 strtmp.SetString(strData,5)替代 Append 后就OK 了。
真相重于对错 2009-03-05
  • 打赏
  • 举报
回复
ansi字符 0x00代表字符串结束
用unicode 字符

TCHAR strData[128]={0x00,0x11,0x22,....};
CString strtmp;

strtmp.Append(strData,5);

7,539

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 VC.NET
社区管理员
  • VC.NET社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧