Hello all,

I have recently tried to build one of my applications in a unicode configuration (by setting the character set in the configuration properties in the general page to 'unicode', I assume that defines the UNICODE and _UNICODE macros for me?). It's the first time I worked with it and so far it's been... let's say 'interesting'.
I read the chapter on Unicode in the 5th edition of the Petzold and the msdn general unicode documentation and that helped me through most problems. However I now have the problem that I have a library (a C dll) that want its arguments as const char* 's. I use ATL's CString throughout my program and I was wondering if there is any unicode conversion support in CString. What I do now is in the line of the following:


CString str("hello");
char* tmp = (char*)malloc(str.GetLength() + 1);
wcstombs(tmp, str, str.GetLength());
LibraryFuncCall(tmp);
free(tmp);

but as you can see this is a lot of work and it makes the code longer. Is there a shorter way? Also, wcstombs stands for 'wide character to multi-byte string' I believe; can I always (for applications with western codepages) consider 'multi-byte' to be 'ascii' ? Sorry if this mail reads confused, it's probably because I am ;) Thanks.

cheers,

roel





Reply via email to