> It's a shame you had not used MFC's CString - it has a (const char *) > extraction operator to get out a char * even under Unicode conditions > (and an (LPCTSTR) extraction operator for getting proper Unicode > characters, as you would use in most other places).
It's not a shame, and your statement is not correct. 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. > The simplest way to find out if UNICODE is defined is to do some > conditional compiling with a known bad line so that the compiler > itself can tell you: > > #ifdef UNICODE > Yes, I'm Unicode // Obviously won't compile, not > valid C++! > #else > No, I'm not Unicode // Obviously won't compile, not > valid C++! > #endif > > The compiler will choke on either line, but at least you'll be able to > tell whether the symbol is defined by which line it complains about - > then you can remove the dummy code. I'd rather use #error which enables you to issue a human readable error code from the compiler which is more helpful than a seemingly unrelated error code the compiler finds in the syntax of the 'statement' it tries to evaluate as C++ code... ------------- Ehsan Akhgari Farda Technology (http://www.farda-tech.com/) List Owner: [EMAIL PROTECTED] [ Email: [EMAIL PROTECTED] ] [ WWW: http://www.beginthread.com/Ehsan ] Close your eyes, and imagine to be without what we take for granted every time we open our eyes...
