E
Elie Roux
Hello,
I would like to write a wide chars string with printf, but I do not
really understand the behaviour I have with this basic test program for
example :
#include <stdlib.h>
#include <stdio.h>
#include <wchar.h>
int main () {
char *syllable="abà";
wchar_t *text=malloc (200 * sizeof(wchar_t));
size_t text_max_length=200;
mbstowcs(text,syllable,text_max_length);
printf ("%ls\n", text);
free(text);
return 0;
}
It does not print the last character, whereas printf("%s\n",syllable)
prints it.
If I change "abà" for something with only ascii characters, I obtain the
good output, but the string I need to write will contain non-ascii
characters.
Does someone have a solution for printing it ?
I'm under ubuntu dapper, my locale is UTF-8...
Thanks,
I would like to write a wide chars string with printf, but I do not
really understand the behaviour I have with this basic test program for
example :
#include <stdlib.h>
#include <stdio.h>
#include <wchar.h>
int main () {
char *syllable="abà";
wchar_t *text=malloc (200 * sizeof(wchar_t));
size_t text_max_length=200;
mbstowcs(text,syllable,text_max_length);
printf ("%ls\n", text);
free(text);
return 0;
}
It does not print the last character, whereas printf("%s\n",syllable)
prints it.
If I change "abà" for something with only ascii characters, I obtain the
good output, but the string I need to write will contain non-ascii
characters.
Does someone have a solution for printing it ?
I'm under ubuntu dapper, my locale is UTF-8...
Thanks,