пробовал так:
Код:
#include <stdio.h>
#include <wchar.h>
#include <string.h>
int main() {
static unsigned const length = 200;
static const wchar_t wcs[] = L"asdsd";
static const char cs[] = "gfdkgjh";
wchar_t mem[length], correct[]=L"|gfdkgjh|asdsd|200|\n";
int diff;
swprintf(mem, length, L"|%s|%S|%d|\n", cs, wcs, length);
diff = wcscmp(mem, correct);
if (diff) { printf("failed!\n"); }
fwrite(mem, sizeof(*mem), wcslen(mem), stdout);
fwrite(correct, sizeof(*correct), wcslen(correct), stdout);
return diff;
}
Код:
[andrey@localhost 1]$ gcc test.c
[andrey@localhost 1]$ ./a.out
|gfdkgjh|asdsd|200|
|gfdkgjh|asdsd|200|
[andrey@localhost 1]$ ./a.out |hexdump -c
0000000 | \0 \0 \0 g \0 \0 \0 f \0 \0 \0 d \0 \0 \0
0000010 k \0 \0 \0 g \0 \0 \0 j \0 \0 \0 h \0 \0 \0
0000020 | \0 \0 \0 a \0 \0 \0 s \0 \0 \0 d \0 \0 \0
0000030 s \0 \0 \0 d \0 \0 \0 | \0 \0 \0 2 \0 \0 \0
0000040 0 \0 \0 \0 0 \0 \0 \0 | \0 \0 \0 \n \0 \0 \0
0000050 | \0 \0 \0 g \0 \0 \0 f \0 \0 \0 d \0 \0 \0
0000060 k \0 \0 \0 g \0 \0 \0 j \0 \0 \0 h \0 \0 \0
0000070 | \0 \0 \0 a \0 \0 \0 s \0 \0 \0 d \0 \0 \0
0000080 s \0 \0 \0 d \0 \0 \0 | \0 \0 \0 2 \0 \0 \0
0000090 0 \0 \0 \0 0 \0 \0 \0 | \0 \0 \0 \n \0 \0 \0
00000a0
[andrey@localhost 1]$ uname -a
Linux localhost 3.14.3-2-ARCH #1 SMP PREEMPT Mon May 12 20:54:05 CEST 2014 i686 GNU/Linux
Возможно вам следует обновиться из репозитория?