char to wchar_t conversion

  • Thread starter Marcin Kalicinski
  • Start date
M

Marcin Kalicinski

wchar_t c1 = wchar_t('A');
wchar_t c2 = L'A';

Is c1 equal to c2?

If they are not equal, how can I create wchar_t character representing the
same character as some char value?

cheers,
Marcin
 
R

roberth+news

| wchar_t c1 = wchar_t('A');
| wchar_t c2 = L'A';
|
| Is c1 equal to c2?

I could not find any guarantee for that in the C++ standard. The only
guarantee i found is that both char(0) and wchar_t(0) shall both have
only zero bits. Apart from that the standard only has limited demands
on the character sets represented by char and wchar_t. Amongst others,
both shall contain the letter A, and rest of the English characters.

| If they are not equal, how can I create wchar_t character representing the
| same character as some char value?

Create a conversion function for the target system. It will probably
port easily if you need it to. Your compiler's documentation should
contain information on how you can write the function.

Since you are asking, you are probably interested in the iconv function,
which is present on UNIX systems. See <URL: http://www.gnu.org/software/libiconv/>,
or search the web.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,130
Latest member
MitchellTe
Top