Trouver le caractère ouvert correspondant à un caractère multibyte

Author:


Download

/*
#include 
int mbtowc ( wchar_t * restrict wc , const char * restrict s ,
            size_t maxsize  );

*/

#include 
#include 
#include 

int main(void)
{

int i = 0, n = 0;
wchar_t wc;
char mbstring[256] = "";

printf( "Votre localité courrante est: %s.n", setlocale(LC_CTYPE, "" ));

while ( (n = mbtowc( &wc, &mbstring[i], MB_CUR_MAX )) != 0 )
{
  if ( n == -1 )
  {
    fputs( "Erreur d'encodage en string multibytes", stderr );
    break;
  }
  printf( "%lc", (wint_t)wc );
  i += n;
};

return 0;
}

/*
Votre localité courrante est: French_France.1252.
Press any key to continue
*/          

Leave a Reply

Your email address will not be published. Required fields are marked *