|
藍森林 http://www.lslnet.com 2006年6月6日 10:18
各位大哥,如何從txt文件中讀取中文字符
我的程序如下
#include "stdio.h"
#include "stdlib.h"
char Getch(char *where)
{
return(getc((FILE *)where));
}
void main()
{
FILE *fp;
char a,b;
fp=fopen("test.txt","r");
a=Getch((char*)fp);
printf("%c==%c",a);
}
txt文本文件的內容為:一架飛機
為什麼打印出來的不是"一",而是亂碼
謝謝 |
各位大哥,如何從txt文件中讀取中文字符
漢字佔兩個字符,另外的你程序好像類型轉換的太多了吧 |
各位大哥,如何從txt文件中讀取中文字符
printf("%c==%c",a); //?這句話你要輸出幾個字符啊?... |
各位大哥,如何從txt文件中讀取中文字符
最後一行打錯了,是printf("%c",a); |
各位大哥,如何從txt文件中讀取中文字符
unix庫中有沒有寬字符的處理函數 |
| |