1

Topic: Conversion of various string types in MFC

How to transform among themselves various string type in MFC? There are types char* (char []), wchar* (wchar []), std:: string, LPTSTR, LPCTSTR, CString and others. How to transform the data from one of this kind to another?

2

Re: Conversion of various string types in MFC

Hello, RussianFellow, you wrote: RF> There are types char* (char []), wchar* (wchar []), std:: string, LPTSTR, LPCTSTR, CString and others. How to transform the data from one of this kind to another? Generally in any way. For transfer from  in  - WideCharToMultiByte and MultiByteToWideChar or macroes T2A and A2T, but they need to be used carefully, there are ghost effects. Classes designers have accepting pointers and as functions returning the type pointer c_str () So that is is specific to you it is necessary in this case use.

3

Re: Conversion of various string types in MFC

Hello, RussianFellow, you wrote: RF> How to transform among themselves various string type in MFC? RF> There are types char* (char []), wchar* (wchar []), std:: string, LPTSTR, LPCTSTR, CString and others. How to transform the data from one of this kind to another? LPTSTR in dependence  at you the project or not will be either char* or wchar* At CString there is  a designer to create from char* or wchar* to transform from char in wchar already described above. I  only functions because macroes, in my opinion, use a stack for conversion. std:: string it not MFC-shnyj type.

4

Re: Conversion of various string types in MFC

Hello, RussianFellow, you wrote: RF> How to transform among themselves various string type in MFC? RF> There are types char* (char []), wchar* (wchar []), std:: string, LPTSTR, LPCTSTR, CString and others. How to transform the data from one of this kind to another? MFC-way: CString csA ("Narrow"); CString csW (L "Wide"); CStringA csA2 (csW); CStringW csW2 (csA);