C语言字库问题,显示不对......
今天一整天我都在写这个汉字字库的程序,过了很多关,但是,最后还是显示的东西看不出是什么字。有哪位热心网友,知道问题在哪,麻烦指教一下,谢谢!!!!!!程序代码:
#include"graphics.h" #include"stdio.h" #include"conio.h" #include"process.h" void main() { int gdriver=DETECT,gmode; FILE *fp; unsigned char code[2]={16,1}; unsigned char qh,wh; unsigned long addr=0; unsigned char buf[32],*ptr; unsigned char i,j,k; unsigned char x=0,y=0; initgraph(&gdriver,&gmode,"C:\\TRUBOC2\\BGI"); setbkcolor(1); setcolor(14); setaspectratio(640,480); qh=code[0]; wh=code[1]; addr=(94*(qh-1)+wh-1)*32; fp=fopen("E:\\HZK16","rb"); if(fp==NULL) { exit(1); } fseek(fp,addr,0); fread(buf,32,1,fp); fclose(fp); ptr=buf; for(i=0;i<16;i++) { for(j=0;j<2;j++) { for(k=0;k<8;k++) { if(((*ptr)&0x80)==0x80) { putpixel(x+20,-y+100+240,14); } if(((*ptr)&0x80)==0x00) { putpixel(x+20,-y+100+240,1); } (*ptr)=(*ptr)<<1; ptr++; x++; } } x=0; y++; } getch(); closegraph(); }