- 论坛徽章:
- 0
|
#define __STDC_ISO_10646__ 200104L
#include <wchar.h>
#include <stdio.h>
#include <stdlib.h>
#define _TEXT(x) L ## x
int main() {
FILE *fp = NULL;
wchar_t *filename = _TEXT("oov.txt");
wchar_t *p = _TEXT("hello你好");
wprintf(_TEXT("%S\n"), p);
wprintf(_TEXT("%d \n"), wcslen(p));
//file * fp;
fp = fopen( "oov.txt", "w");
fwprintf(fp, _TEXT("%S"), p);
fclose(fp);
return 0;
}
|
最后的源码
打印出来 hello??
文件里面也是 ??
LANG=zh_CN.UTF-8
LC_CTYPE="zh_CN.UTF-8"
LC_NUMERIC="zh_CN.UTF-8"
LC_TIME="zh_CN.UTF-8"
LC_COLLATE="zh_CN.UTF-8"
LC_MONETARY="zh_CN.UTF-8"
LC_MESSAGES="zh_CN.UTF-8"
LC_PAPER="zh_CN.UTF-8"
LC_NAME="zh_CN.UTF-8"
LC_ADDRESS="zh_CN.UTF-8"
LC_TELEPHONE="zh_CN.UTF-8"
LC_MEASUREMENT="zh_CN.UTF-8"
LC_IDENTIFICATION="zh_CN.UTF-8"
LC_ALL=
我认为打不来也就罢了, 为什么文件也不行呢?
centos 5.0 |
|