Back to index

glibc  2.9
testmb2.c
Go to the documentation of this file.
00001 /* Test case by Miloslav Trmac <mitr@volny.cz>.  */
00002 #include <locale.h>
00003 #include <stdint.h>
00004 #include <stdlib.h>
00005 #include <stdio.h>
00006 
00007 int
00008 main (void)
00009 {
00010   wchar_t wc;
00011 
00012   if (setlocale (LC_CTYPE, "de_DE.UTF-8") == NULL)
00013     {
00014       puts ("setlocale failed");
00015       return 1;
00016     }
00017 
00018   if (mbtowc (&wc, "\xc3\xa1", MB_CUR_MAX) != 2 || wc != 0xE1)
00019     {
00020       puts ("1st mbtowc failed");
00021       return 1;
00022     }
00023 
00024   if (mbtowc (&wc, "\xc3\xa1", SIZE_MAX) != 2 || wc != 0xE1)
00025     {
00026       puts ("2nd mbtowc failed");
00027       return 1;
00028     }
00029 
00030   return 0;
00031 }