这是一段24点阵的字库取模显示,但是运行的时候却显示乱码
大家帮忙看看是哪有问题
谢谢大家
#include<stdio.h>
#include<string.h>
#include<graphics.h>
FILE *hzk_p;
void open_hzk(void);
void get_hz(char incode[],char bytes[]);
void dishz(int x,int y,char code[],int color);
main()
{
int gmode;
int x=38;
int y=110;
char *s="中华人民共和国";
int gdriver=DETECT;
gmode=0;
initgraph(&gdriver,&gmode,"f:\\tc200");
cleardevice();
open_hzk();
while(*s!=NULL)
{
while(x<640&&(*s!=NULL))
{
dishz(x,y,s,LIGHTRED);
x+=20;
s+=2;
}
x=20;
y+=20;
}
getch();
fclose(hzk_p);
closegraph();
}
void open_hzk()
{
hzk_p=fopen("f:/tc200/hzk16/hzk24s","rb");
}
void get_hz(char incode[],char bytes[])
{
unsigned char qh,wh;
unsigned long offset;
qh=incode[0]-0xa0;
wh=incode[1]-0xa0;
offset=(94*(qh-1)+(wh-1))*48;
fseek(hzk_p,offset,SEEK_SET);
fread(bytes,48,1,hzk_p);
}
void dishz(int x0,int y0,char code[],int color)
{
unsigned char mask[]={0x80,0x40,0x20,0x10,0x08,0x04,0x02,0x01};
int i,j,x,y,pos;
char mat[48];
get_hz(code,mat);
y=y0;
for(i=0;i<24;++i)
{
x=x0;
pos=2*i;
for(j=0;j<24;++j)
{
if((mask[j%8]&mat[pos+j/8])!=NULL)
putpixel(x,y,5);
++x;
}
++y;
}
}