I'm trying to do something simple here when I execute the following code in Visual Studio 2008 using Unicode character set So, xmlString is right.
Unfortunately, I need to convert CSTT into an unsigned cell *. Using the code given below, UCART "& lt;" (I.e. the first letter of xmlString).
How should I change CString into an unsigned char * and maintain all the information?
CString xmlString; XmlString.Format (_T ("& lt ;? Xml version = \" 1.0 \ "encoding = \" ISO-885 9-1 \ "? Gt; gt; & lt; config-read & gt; & Lt;% s / & gt; & lt; / Config-read & gt; & lt; / gateway & gt; "), keyname); Unsigned four * ucStr = reinterpret_cast & lt; Unsigned char * & gt; (XmlString.GetBuffer ()); PgIRequest-> SendXmlData ("dgv / gateway.xml", ucStr, xmlString.GetLength () + 1);
I know that using the CSTIRDA constructor is simple, like:
CSSTING xmlString; XmlString.Format (_T ("& lt ;? Xml version = \" 1.0 \ "encoding = \" ISO-885 9-1 \ "? Gt; gt; & lt; config-read & gt; & Lt;% s / & gt; & lt; / Config-read & gt; & lt; / Gateway & gt; ")," Test "); Printf ("% s \ n", xmlString); // fails "& lt;" // unsigned char * ucStr = reinterpret_cast & lt; Unsigned char * & gt; (XmlString.GetBuffer ()); CStringA ucStr (xmlString); Printf ("% s \ n", ucStr); // Works!
Comments
Post a Comment