Prev: How to make CFileDialog, MessageBox etc ..Layered ?
Next: Changing Tab Control BackGround and Foreground COlor
From: Mihai N. on 9 Oct 2009 04:42 > How can I convert const char * to wchar_t? > Example: char *argv[] is my array and i want it to pass to different > file which accept only WCHAR **argv where WCHAR is defined as typedef > wchar_t WCHAR Some good answers already. But since you mention *argv[], I would guess that comes from main. So, why not get directly Unicode in main? wmain to always get wchar_t, _tmain for generic text data types -- Mihai Nita [Microsoft MVP, Visual C++] http://www.mihai-nita.net ------------------------------------------ Replace _year_ with _ to get the real email
From: David Wilkinson on 9 Oct 2009 06:32
Manni wrote: > Hi ... > How can I convert const char * to wchar_t? > Example: char *argv[] is my array and i want it to pass to different > file which accept only WCHAR **argv where WCHAR is defined as typedef > wchar_t WCHAR Manni: The first thing to ask yourself is why you want to do this. As a rule, programs should be written either entirely using 8-bit characters (char in C++) or 16-bit characters (wchar_t in C++). The latter is preferred in modern Windows programming because the native character set of Windows NT/2000/XP/Vista/7/.. is UTF-16. If you want a program that will compile for either 8-bit or 16-bit characters then you can use TCHAR. -- David Wilkinson Visual C++ MVP |