HZ.CPP
上传用户:phillytech
上传日期:2007-01-07
资源大小:561k
文件大小:2k
- #define k ' '
- #include <stdlib.h>
- #include <conio.h>
- #include <stdio.h>
- #include <dos.h>
- #include <graphics.h>
- #include <bios.h>
- #define X 100
- #define Y 200
- int test(unsigned int ,int);
- char *getwm()
- { char *p,*wm;
- FILE *fp;
- int j,i1,j1;
- long num;
- unsigned char i[3];
- p=(char*)malloc(32*sizeof(char));
- fp=fopen("hzk16","rb++");
- printf ("这是提取汉字字库的程序:n");
- printf ("请输入一个汉字:n");
- if(((i[0]=getch())&0x8080)!=0)
- {i[1]=getch();
- printf ("该汉字的机内码是:%2x,%2xn",i[0],i[1]);
- i[2]=' ';
- printf ("该汉字是:%sn",i);
- }
- else
- {printf ("该汉字的机内码:%2xn",i[0]);
- printf ("该字符是:%cn",i[0]);
- num=188+i[0]-33;
- goto zf;
- }
- i[0]=i[0]&0x7f;
- i[1]=i[1]&0x7f;
- i[0]=i[0]-0x20;
- i[1]=i[1]-0x20;
- num=(i[0]-1)*94+(i[1]-1);
- zf: if(fp==NULL)
- {printf ("文件打开失败!n");
- exit(0);
- }
- fseek(fp,(32)*num,0);
- fread(wm,32,1,fp);
- fclose(fp);
- return (wm);
- }
- int test(unsigned int a,int j)
- {
- unsigned b ;
- b=a;b<<=(j-1);
- if(b&0x80)
- return (1);
- else
- return (0);
- }
- void cls()
- {
- union REGS r;
- r.h.ah=6;r.h.al=0;
- r.h.ch=0;r.h.cl=0;
- r.h.dh=24;r.h.dl=79;r.h.bh=7;
- int86(0x10,&r,&r);
- }
- void main(void)
- {
- int xx=0;
- int yy=0;
- int a=9,b=2;
- initgraph(&a,&b,"");
- register i,j;
- char *getwn(),*p;
- p=(char*)malloc(32*sizeof(char));
- p=getwm();
- for (i=0;i<32;i++)
- {
- for (j=1;j<=8;j++)
- if(test(p[i],j)==0)
- printf ("%c%c",k,k);
- else
- printf ("%c%c",' 03',' 03');
- {
- }
- if ((i+1)%2==0)
- printf ("n");
- }}