CSTRING to Unicode conversion

xiaoxiao2021-03-06  42

Http://www.opc-china.com The following code is used for the String to the UnicDe code under the GSM Modem AT command. CString ExchangeMsg (CString MSG) {CSTRING RETSTR; CHAR AA [500] = ""; int LEN = msg.getlength (); bstr x = msg. Allocsystring (); long Num = * ((long *) x-1) For (int i = 0; i = len) Break; char CC [10] = ""; if ((* x >> 8) == 0) {Sprintf (AA, "% S00% X", AA, * X); msg = msg.right (msg.getLength () -1);} else {sprintf (AA, "% S% x", aa, * x) ; Msg = msg.right (msg.getLength () -2); i = i 1;} sysfreestring (x); x = msg. Allocsystring ();} sysfreestring (x); char bb [10] = "" INT LEN1 = Strlen (AA); char TXT [500] = ""; if (len1% 4! = 0) {MEMCPY (TXT, AA, (LEN1-3));

} Else {membcpy (txt, aa, len1);} if (Num <= 0x0f) {Sprintf (BB, "0% X", NUM);} else {sprintf (BB, "% x", Num);} Retstr.format ("% s% s", bb, txt); retstr.makeupper (); int msglth = RetStr.getLength (); Return RetStr;} OPC Technology Forum http://www.opc-china.com OPC Server, customer program technology discussion

转载请注明原文地址:https://www.9cbs.com/read-62404.html

New Post(0)