Click to See Complete Forum and Search --> : CString to BYTE array


EirikO
July 18th, 2007, 05:00 AM
I have a program that sends a message over a serial port and when I test it with a message like
BYTE Msg[] = "20\r";
everything is ok.

The problem is that I do not want to send "20" everytime.. The message I want to send comes from a CEdit box and I get it with

...
UpdateData(TRUE);
CString Msg;
m_Felt3.GetWindowText(Msg);
Msg.Format(_T("%s\r"),(LPCTSTR)Msg);
UpdateData(FALSE);
...


How can I change this to be a byte-array like my first example?

I also need to know the number of bytes in my message....

I guess this is wrong part of the forum.. I also posted it in "Visual c++ programming" now.. Sorry!