MFC CString转unsigned char
CString是MFC当中经常使用的数据类型,通常程序也经常需要将其转换为unsigned char数组存储和处理,如何完成这个转换了?
CString cs1 = "gettruckpos";
byte buf[200];
memcpy(buf,cs1.GetBuffer(cs1.GetLength()),cs1.GetLength()); //将cstring放入byte数组
CString *pPhoneNum =new CString((char*)buf, cs1.GetLength()); //将byte数组转换成cstring
CString cs2 = *pPhoneNum;
posted on 2015-12-26 09:43 camelbrand 阅读(3509) 评论(0) 收藏 举报
浙公网安备 33010602011771号