Link to home
Start Free TrialLog in
Avatar of mr_stevie
mr_stevieFlag for Australia

asked on

Multiple WCHAR_T to CString

Hey guys,

I have a series of wchar_t variables and I wish to combined them and make it into a CString variable:

// Example
wchar_t x1 = 'T';
wchar_t x2 = 'e';
wchar_t x3 = 's';
wchar_t x4 = 't';

CString test;

I wish to add x1, x2, x3 and x4 into the CString "test".

Thank you in advance!
Avatar of lucky_james
lucky_james
Flag of India image

wchar_t x1 = 'T';
wchar_t x2 = 'e';
wchar_t x3 = 's';
wchar_t x4 = 't';
CString test;

CString x1_temp = x1;
CString x2_temp = x2;
CString x3_temp = x3;
CString x4_temp = x4;
test = x1_temp + x2_temp + x3_temp + x4_temp;

Avatar of mr_stevie

ASKER

Unfortunately I get the following error:
error C2440: 'initializing' : cannot convert from 'wchar_t' to 'ATL::CStringT<BaseType,StringTraits>'      
ASKER CERTIFIED SOLUTION
Avatar of lucky_james
lucky_james
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Works like a charm!
Thanks mate!