char to wchar_t conversion

Discussion in 'C++' started by Marcin Kalicinski, Dec 7, 2005.

  1. 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
     
    Marcin Kalicinski, Dec 7, 2005
    #1
    1. Advertising

  2. Marcin Kalicinski

    Guest

    Marcin Kalicinski <> wrote:
    | 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.
    --
    Robert Bauck Hamar
     
    , Dec 7, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Adrian Cornish
    Replies:
    2
    Views:
    8,257
    Adrian Cornish
    Jul 12, 2003
  2. lovecreatesbeauty
    Replies:
    1
    Views:
    1,152
    Ian Collins
    May 9, 2006
  3. George2
    Replies:
    1
    Views:
    317
    Ian Collins
    Nov 26, 2007
  4. Replies:
    3
    Views:
    1,186
    James Kanze
    Aug 15, 2008
  5. kmw
    Replies:
    3
    Views:
    1,241
Loading...

Share This Page