how to convert CString to Bytes

断了今生、忘了曾经 提交于 2019-12-09 07:08:24

Well CString is a C++ class so doing it in C is a little unlikely.

But if you wish to get it as a standard multi-byte encoded string then you can do the following

CString data    = "world is beautiful";
CStringA mbStr  = data;
char* bytes     = mbStr.GetString();

In C the char type is defined as one byte in memory. Hence storing your string as a char * would be equivalent to storing a byte array in C#.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!