Ehsan Akhgari wrote:
CString does *not* provide a const char* operator.  All it provides is
operator LPCTSTR(), which is not useful for the purpose of converting
between Unicode/non-Unicode strings.  In fact, CString provides *no*
facility of charatcer conversion.
As an aside, I don't know why this assumption is so common about CString.
I've seen people mention this a lot of times, and I don't know what makes
them believe so.

Hmm, but if I do this (in a unicode build):

ATL::CString str(_T("T"));
ATL::CStringA astr;
astr = str;

then astr will contain an ascii string, converted and all. Why isn't this character conversion? For the record, I got this from someone on the WTL list. Anyway, wrt to std::string: frankly, I think it sucks for unicode applications. There is no build-in support for conversions and std::wstring isn't available on every platform. On windows one could use std::basic_string<TCHAR> but then all the changes like you have in the header file you included in another message are needed; quite frankly, that's a PITA. As long as a program is tied to windows (like any ATL/WTL program is), I still think CString is a better choice than std::string. Time may prove me wrong, we'll see :)

cheers,

roel







Reply via email to