#include <stdio.h>
#include <conio.h>
#include <fcntl.h>
int HZK_file;
int ASC_file;
int HZ_x,HZ_y;
void openhzfile()
{
if((HZK_file=open("HZK16",O_RDWR|O_BINARY))==-1)
{
printf("\n\n\t Open HZK16 error!");
getch();
exit(0);
}
if((ASC_file=open("ASC16",O_RDWR|O_BINARY))==-1)
{
printf("\n\n\t Open ASC16 error!");
getch();
exit(0);
}
}
int outhz(unsigned char *hz)
{
int i=0,j=0,k=0;
int x=0,y=0;
int r=0;
long p=0;
char bit[32];
unsigned int hzasc=0,qm=0,wm=0,flat=0;
x=HZ_x;
y=HZ_y;
rewind(HZK_file);
while(hzasc=*hz)
{
if(hzasc>0xa1)
if(flat==0)
{
qm=(hzasc-0xa1)&0x07f;
flat=1;
}
else
{
wm=(hzasc-0xa1)&0x07f;
r=qm*94+wm;
p=r*32l;
lseek(HZK_file,p,SEEK_SET);
read(HZK_file,bit,32);
for(i=0;i<16;i++)
for(j=0;j<2;j++)
for(k=0;k<8;k++)
if((bit[i*2+j]>>(7-k))&0x01)
{
gotoxy(x+j*8+k,y+i);
printf("*");
}
flat=0;
x+=16;
}
else
{
lseek(ASC_file,(*hz)*16l,SEEK_SET);
read(ASC_file,bit,16);
for(i=0;i<16;i++)
for(k=0;k<8;k++)
{
if((bit[i]>>(7-k))&0x01)
{
gotoxy(x+j*8+k,y+i);
printf("*");
}
}
x+=8;
}
*hz++;
}
}
main()
{
openhzfile();
outhz("我是谁?");
getch();
}