1
2 /*
3
4 读取汉字字模
5 TC 2.0
6
7 */
8
9 #define STRING "程序: Z.Bin CopyRight Ver 1.0 98-10-05"
10 #define CHAR_BYTE 40
11 #define OUTPUT_FILE "c:\\dat"
12 #define SIZE CHAR_BYTE*16
13 #include <stdio.h>
14 #include <graphics.h>
15 #include <conio.h>
16 #include <stdlib.h>
17
18 void main()
19 {
20 int At_x,color;
21 int g=0;int m;
22 int CharNumber;
23 int k;
24 int i,j;
25 char buf[SIZE];
26 char *p;
27 char a;
28 FILE *fp;
29 initgraph(&g,&m,"C:\TC");
30 p=buf;
31 if((fp=fopen(OUTPUT_FILE ,"wb"))==NULL)
32 return 0;
33 printf(STRING);
34 for(i=0;i<=223;i++)
35 {
36 buf[i]=0;
37 }
38 At_x=0;
39
40 for(CharNumber=0;CharNumber<CHAR_BYTE;CharNumber++)
41 {
42
43 for(j=0;j<=15;j++)
44 {
45 for(i=0;i<=7;i++)
46 {
47 color=getpixel(At_x+i,j);
48 if(color)
49 {a=1; a=a<<(7-i);
50 (*p)=(*p)|a;
51 }
52 }
53 p++;
54 }
55 At_x+=8;
56 }
57 fwrite(buf,1,SIZE,fp);
58 fclose(fp);
59 /*getch();*/
60 closegraph();
61 return 0;
62 }