微信公众号 
图码生活

每天发布有五花八门的文章,各种有趣的知识等,期待您的订阅与参与
电脑报 1992-2001 十年文章全集
电脑报 1992-2001 十年文章全集
包含从 1992 年 - 2001 年间,两万余篇期刊文章,查询最少输入两个字符
随便看看
读取中
读取中
标题建立小型汉字库的方法
栏目软件操作与技巧
作者袁津生
发布1993-07-30
  建立汉字库程序是用Turbo C编写的。
  源程序如下:
  /建立汉字库程序/
  #include"stdlib.h"
  #include"stdio.h"
  #include"fcntl.h"
  #include"graphics.h"
  char buffer[32];
  FILEfp,fpl;
  intxl,x2,i,f=0;
  unsigned charhz,str[40];longhs;
  main()
  {
  intdriver=VGA,mode=2;
  initgraph(&driver,&mode,"");
  fp=fopen("c:\\213
  \\hzk16","rb");
  /*打开字库文件/
  if(fp==NULL){print f("could not open hzk16!");exit(1);}
  while(1){
  fpl=fopen("xhzk","ab");
  /打开小型汉字库/
  printf("\n请输入汉字[Q]退出!");
  hz=str;
  scanf("%s",hz);
  if(str[0]=='Q')break;
  while((i=hz++)!=0){
  if(i〉0xal)
  if(f==0){
  xl=(i0xal)&0x07f;
  f=1;}
  else{
  x2=(i0xal)&0x07f;
  f=0;
  hs=(xl_23)94321+(x223)321;
  /字模在字库中地址/fseek(fp,hs,SEEK___SET);/确定指针位置/
  fread(buffer,32,1,fp);
  /将数据读入内存/
  fwrite(buffer,32,1,fpl);
  /写数据到新字库/
  }}
  fclose(fpl);}
  fclose(fp);
  }