How to Convert CString to BYTE
Posted on 2006-06-24
HI can anyone show me how to convert a CString to a BYTE array. This a a small bit of code I am using to pass a string from a textbox to a CString but I need to convert the CString to a BYTE array
CString ss = "123ABC";
BYTE* bp = (BYTE*)ss.GetBuffer(ss.GetLength());
BYTE expected = bp; //"This is a test";
My code works with the string "This is a test" but I need to pass the string from a textbox I know how to pass from the textbox to a CString but cant get the conversion from CString to BYTE array.