titanandrews
Programmer
Hello All,
I have come to the conclusion that strings in C++ are a pain in the ass. Why can't they all be UNICODE? Why is there 50,000 string classes?![[mad] [mad] [mad]](/data/assets/smilies/mad.gif)
Ok, I'm over it now... Could someone please tell me how to convert a CString to a const char* in UNICODE environment? The following code:
works fine in a non UNICODE environment, but in UNICODE enabled environment, I get this from C++ compiler:
I tried reinterpret_cast, but it just gives me garbage.
many thanks,
Barry
I have come to the conclusion that strings in C++ are a pain in the ass. Why can't they all be UNICODE? Why is there 50,000 string classes?
![[mad] [mad] [mad]](/data/assets/smilies/mad.gif)
Ok, I'm over it now... Could someone please tell me how to convert a CString to a const char* in UNICODE environment? The following code:
Code:
int retValue = system(myCommand.GetBuffer(myCommand.GetLength()));
Code:
error C2664: 'system' : cannot convert parameter 1 from 'unsigned short *' to 'const char *'
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
I tried reinterpret_cast, but it just gives me garbage.
many thanks,
Barry