Click here to Skip to main content
14,884,042 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hey guys,

I really don't know anymore how to converte char to CString in MFC.
Can somebody help me please?


Greetings
Epanjohura
Posted
Updated 28-Sep-12 2:24am
v2

You can just use the overloaded assignment operator/constructor/copy constructor of CString.

C++
CString strVarible;
strVarible = CString('a');


For more details :
See this[^]

[Edit :- Removed the wrong code I pasted mistakenly.]
   
v4
Comments
epanjohura 28-Sep-12 8:43am
   
thanks a lot =)
Malli_S 17-Feb-14 2:22am
   
Welcome.
You may use the CString constructor for such a task. e.g.
C++
CString s1(_T('a')); // from single character
CString s2(_T("foo")); // from string literal
   
v2
Comments
CPallini 28-Sep-12 8:29am
   
Thank you for the fix.
epanjohura 28-Sep-12 8:44am
   
thanks a lot =)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900