I guess that your project is set to Unicode.
Then the
CString
class is
wchar_t
based. These Unicode chars are 16 bit wide and ASCII characters (codes 0x00 to 0x7f) have the high byte cleared. But your micro controller probably expects ASCII characters and the cleared high byte is treated as the end of string indicator.
The simplest solution would be using the
CStringA
class. The
A
indicates that it is an ANSI string:
CStringA strTT126;
double dTT126 = (m_nSliderTT126/8.4)-3.81;
strTT126.Format("%.02f", dTT126);
SDSWriteFIFO(Ident, (const unsigned char*)strTT126.GetString());
Note also that I have used the
GetString()
member function to pass the string. This can be used when the
SDSWriteFIFO()
parameter is of type
const unsigned char*
.
If the parameter is not const and that is a function written by you, try to make that parameter const. Otherwise you have to use
GetBuffer()
instead as already used. But then don't forget to call
ReleaseBuffer()
afterwards:
LPSTR buf = strTT126.GetBuffer(strTT126.GetLength());
SDSWriteFIFO(Ident, (unsigned char*)buf);
strTT126.ReleaseBuffer();