漢字在計算機內部的內碼是佔2個字節的。
#include<stdio.h>
#include<stdlib.h>
int main()
{
FILE *fp;
char string[21];
if((fp=fopen("E:\\c.txt","rt"))==NULL)
{
printf("\nOpen error!\n");
exit(0);
}
fgets(string,21,fp);
printf("\n%s\n",string);
fclose(fp);
fp=NULL;
return 0;
}
而所打開的文件裏的內容卻遠遠不止這些