C++ – how to convert CString to Bytes

bytec++cstringstring

i am actually tryin to convert a csharp code to c… below is the C# code..

CString data = "world is beautiful";    
Byte[] quote = ASCIIEncoding.UTF8.GetBytes(data);

in the above code… it converts the string into bytes..similarily is ther a way that i can convert it using C..
Can any body tell what wud be the quivalent code in C?
Please help me guys

Best Solution

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();