wchar_t to char[128]

Discussion in 'C Programming' started by Manoj Jangid, Dec 6, 2007.

  1. Manoj Jangid

    Manoj Jangid Guest

    Hi
    how do i convert wchar_t to char[128] or vice versa

    Kind Regards
     
    Manoj Jangid, Dec 6, 2007
    #1
    1. Advertising

  2. [c and c++ are not the same langauge; my answer is for c (since you posted
    to clc) so i'm not following your followup-to.]

    in comp.lang.c i read:

    >how do i convert wchar_t to char[128] or vice versa


    a single wide-character can be converted to a multi-byte character sequence
    with the wctomb function.

    if the wchar_t corresponds with a single char then wctob may be used, and
    you may use it to determine if such is the case, though if you are prepared
    for up to MB_CUR_MAX bytes of result you may as well just use wctomb.

    to convert a multi-byte character sequence into a wide-character use mbtowc.
    if you have string of multi-byte characters then look at mbstowcs, which
    produces a wide-character string result.

    each of these may fail so be sure to pay attention to the return value.

    --
    a signature
     
    those who know me have no need of my name, Dec 6, 2007
    #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. lovecreatesbeauty
    Replies:
    1
    Views:
    1,099
    Ian Collins
    May 9, 2006
  2. Replies:
    6
    Views:
    338
    Pete Becker
    Sep 11, 2006
  3. Replies:
    3
    Views:
    1,132
    James Kanze
    Aug 15, 2008
  4. Eric Sosman

    Re: Integer 128 != Integer 128 ??

    Eric Sosman, Oct 12, 2010, in forum: Java
    Replies:
    6
    Views:
    863
    Screamin Lord Byron
    Oct 13, 2010
  5. chankey pathak

    Re: Integer 128 != Integer 128 ??

    chankey pathak, Oct 13, 2010, in forum: Java
    Replies:
    0
    Views:
    863
    chankey pathak
    Oct 13, 2010
Loading...

Share This Page