Re: simplest way to convert a char * to wchar *?
- From: Ulrich Eckhardt <eckhardt@xxxxxxxxxxxxxx>
- Date: Wed, 05 Mar 2008 09:13:15 +0100
byaarov@xxxxxxxxx wrote:
Hi, what is the simplest way to convert a char * string to a wchat *
string?
There is no simple way. The reason is that the definition of e.g. char(150)
is not as well-defined as the definition of wchar_t(0x20ac). In order to
interpret char strings, you need to know the encoding they use, while for
wchar_t strings the encoding can be assumed as fixed on win32.
If you know that the char string uses only ASCII, you can use std::copy().
If the encoding is something else, you need to use MultibyteToWideChar()
with the according encoding.
Uli
--
C++ FAQ: http://parashift.com/c++-faq-lite
Sator Laser GmbH
Geschäftsführer: Michael Wöhrmann, Amtsgericht Hamburg HR B62 932
.
- References:
- simplest way to convert a char * to wchar *?
- From: byaarov
- simplest way to convert a char * to wchar *?
- Prev by Date: Re: difference in VC 6 and vc 2008 in "for block"
- Next by Date: Re: JavaDoc kind of VC++ API
- Previous by thread: Re: simplest way to convert a char * to wchar *?
- Next by thread: Re: simplest way to convert a char * to wchar *?
- Index(es):
Relevant Pages
|