How to convert unsigned short[50] to CString?

How to convert unsigned short[50] to CString, the following is a example for this:

TCHAR Key[50];

CString strParam1;

strParam1 = Key;

for the above statement, how to realize the data conversion in vc2005

Thanks you very much.




Answer this question

How to convert unsigned short[50] to CString?

  • ermark

    Christian is right!

    But I wonder why you get problems with the shown code. If either UNICODE or not UNICODE is defined the assignment of a TCHAR array to a CString always work.

    What is the error of the compiler you get



  • percent20net

    CString and TCHAR will work as per your current build environment. I dont think a CString can't load a unicode string in UNICODE build environment


  • Cesar Francisco

    What version of MFC is this ( i.e. what compiler ). I thought later ones did this for you, CString is Unicode aware.

    CString strParam1(&Key[0]);



  • How to convert unsigned short[50] to CString?