Conversion
-
Hi I am devloping an application in MFC I need to convert UCAHR pointer to Cstring and vice versa such as UCHAR *pMsg; pMsg[0] = '1'; pMsg[1] = '2'; pMsg[3] = '3'; pMsg[4] = NULL to CString and viceversa... Can anybody help.
-
Hi I am devloping an application in MFC I need to convert UCAHR pointer to Cstring and vice versa such as UCHAR *pMsg; pMsg[0] = '1'; pMsg[1] = '2'; pMsg[3] = '3'; pMsg[4] = NULL to CString and viceversa... Can anybody help.
reddy07 wrote:
UCHAR *pMsg; pMsg[0] = '1'; pMsg[1] = '2'; pMsg[3] = '3'; pMsg[4] = NULL
As it stands, there is a access violation on your horizon. Anyway the
CString
constructor is probably able to handle your unsigned char array, for instance tryCString s((char*) pMsg);
On the other hand, if you need to convert the
CString
value to an array ofunsigned char
s, then the effort required may depend on the type of build you are doing, UNICODE or not. :)If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler. -- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong. -- Iain Clarke
[My articles] -
Hi I am devloping an application in MFC I need to convert UCAHR pointer to Cstring and vice versa such as UCHAR *pMsg; pMsg[0] = '1'; pMsg[1] = '2'; pMsg[3] = '3'; pMsg[4] = NULL to CString and viceversa... Can anybody help.
Hello! If you wanted a deeper understanding of the topic, I'll recommend you this article: CString Management[^].
It is a crappy thing, but it's life -^ Carlo Pallini
-
Hello! If you wanted a deeper understanding of the topic, I'll recommend you this article: CString Management[^].
It is a crappy thing, but it's life -^ Carlo Pallini