c语言字库编程问题
现在是可以一次输入一个汉字,谁给改成一次可以输入n个汉字啊,n不确定,主要是怎么才知道输入了多少汉字啊?求指教#include<stdio.h>
#include<stdlib.h>
void main()
{
int one_word(char);
unsigned char code[3];
printf("请输入汉字:\n");
scanf("%s",&code);
one_word(code);
}
int one_word(word)//一次显示一个汉字
unsigned char word[3];
{
FILE* fphzk = NULL;
int i, j, k, offset;
int flag;
unsigned char qh,wh;
unsigned char buffer[32];
unsigned char key[8] = {0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01};//位屏蔽字
if((fphzk = fopen("hzk16", "rb")) == NULL)
{
printf("Can't Open hzk16\n");
exit(0);
}
qh = word[0] - 0xa0; //获得区码
wh = word[1] - 0xa0; //获得位码
offset = (94 * (qh - 1) + (wh - 1)) * 32; //得到偏移位置
fseek(fphzk, offset, SEEK_SET);
fread(buffer, 1, 32, fphzk);
for(k=0; k<16; k++)
{
for(j=0; j<2; j++)
{
for(i=0; i<8; i++)
{
if(flag = buffer[k*2+j]&key[i])
{
printf("%s", "●");
}
else
{
printf("%s", "○");
}
}
}
printf("\n");
}
fclose(fphzk);
return 0;
}