CH语言高手请进!!急!1

来源:百度知道 编辑:UC知道 时间:2024/06/21 04:47:19
下面的程序就是以UCDOS中16×16点阵字库HZK16作为提取汉字点
阵用的源字库,依据输入的汉字来确定其内码,从而从HZK16中提取汉字点阵。
#include “stdio.h”
#include “stdlib.h”
#include “io.h”
#include “conio.h”
#include “dos.h”
#include “fcntl.h”
#define NUM 20 /* 10个汉字,可以根据需要改变*/
struct
{
unsigned int code; /*汉字内码*/
unsigned char dot[32] /*汉字点阵*/
}lib[NUM];
union
{
unsigned char ch[2];
unsigned int i;
}ch_code;
FILE *fphz,*fpin,*fpout; /*三个文件指针*/
void drawdots(unsigned int incode,int num); /*读取点阵函数*/
main(int argc,char *argv[])
{
int num; /*汉字个数*/
int i,j;
if (argc<3)
{
printf(“Format must be:makepoint<fileinput><fileoutput>\n”);
exit(1);
}
fphz=fopen(“hzk16”, “rb”); /*打开汉字库HZK16*/
if(fphz==NULL)
{
printf(“Can’t open the chinese library hzk16.\n”);
exit(1);
}
f

argc是参数的个数,argv是所属参数的数组,argv[0]就是你的程序名。
假设你的程序名字是test.exe,那么argc=1, argv[0]="test.exe";
如果你启动程序的命令行有另外两个参数:test -a -b,那么argc=3,argv[1]="-a", argv[2]="-b"。

貌似这个程序的启动命令是:
makepoint <一个输入文件名> <一个输出文件名>
这个输入文件里就是汉字,你用txt文本随便写点就行;
输出文件随意起名字;
还要有个叫hzk16的字库文件,跟程序放在同一个目录下。