来源:http://blog.csdn.net/turingo/article/details/8191712
-
#include
-
-
#define FONT_SIZE (16) /* 字体大小 */
-
-
-
-
-
-
#define HZ_INDEX(hz) ((hz[0] - 0xa1) * 94 + (hz[1] - 0xa1))
-
#define DOTS_BYTES (FONT_SIZE * FONT_SIZE / 8) /* 汉字点阵数据所占的字节数 */
-
-
int main(int argc, char* argv[])
-
{
-
FILE* hzk;
-
unsigned char song[2] = "\xcb\xce";
-
unsigned char dots[DOTS_BYTES];
-
unsigned char b;
-
int i, j, k;
-
-
-
if((hzk = fopen("hzk16", "rb")) == NULL)
-
{
-
return -1;
-
}
-
fseek(hzk, HZ_INDEX(song) * DOTS_BYTES, SEEK_SET);
-
fread(dots, sizeof(unsigned char), DOTS_BYTES, hzk);
-
fclose(hzk);
-
-
-
for(i = 0; i < FONT_SIZE; i++)
-
{
-
-
for(j = 0; j < FONT_SIZE / 8; j++)
-
{
-
b = dots[i * 2 + j];
-
-
for(k = 0; k < 8; k++)
-
{
-
if(b & 0x80)
-
printf("%c ", '*');
-
else
-
printf(" ");
-
b <<= 1;
-
}
-
}
-
printf("\n");
-
}
-
-
return 0;
-
}
程序编译运行后会出现如下的显示效果,
-
*
-
*
-
* * * * * * * * * * * * * *
-
* *
-
* * *
-
*
-
* *
-
* * * * * * * * * * * * * * *
-
* * *
-
* * *
-
* * * *
-
* * * * *
-
* * *
-
* *
-
*
-
*
-
阅读(1460) | 评论(0) | 转发(0) |