![]() |
中国DOS联盟-- 联合DOS 推动DOS 发展DOS --联盟域名:www.cn-dos.net 论坛域名:www.cn-dos.net/forum |
| 游客 | 登录 | 注册 | 会员 | 搜索 | 中国DOS联盟 |
|
中国DOS联盟论坛 现在时间是 2026-08-12 12:59 |
共 47,811 主题排行 / 349,897 发帖 / 今日 0 篇 / 48,256 会员排行 |
| DOS学习入门 & 精彩文章 (教学室) » dos下的c编程,如何才能显示汉字? |
| 可打印版本 1,616 / 4 |
| 第1楼 imur02 | 发表于 2009-02-12 10:48 |
| 初级用户 发帖 12 积分 35 | |
|
dos下的c编程,如何才能显示汉字? dos下的c编程,如何才能显示汉字?
谢谢先 |
|
| 第2楼 Sufone | 发表于 2009-02-12 12:21 |
| 中级用户 发帖 124 积分 256 | |
|
加载汉字系统
|
|
| 第3楼 pujihong123 | 发表于 2009-02-12 22:22 |
| 初级用户 发帖 27 积分 47 来自 甘肃. 武威 | |
|
你google 一下,估计要加载一个小程序!
|
|
| 第4楼 tty1a | 发表于 2009-02-13 17:55 |
| 初级用户 发帖 7 积分 20 | |
|
是自己写C程序吗?
Turbo c下,可以自己从字体文件中提取字模,然后画出来就可以了。 给你一段代码吧。字模文件你可以在本论坛上找到很多--HZK16 代码如下: #include <stdio.h> #include <stdlib.h> #include <string.h> #include <dos.h> #include <conio.h> #include <graphics.h> int disphz(int left,int top,unsigned char byte1,unsigned char byte2,int color) { FILE *fp; struct linesettingstype oldlinetype;unsigned int buf[16]; unsigned char mark;long p;int x,y,i;int qu,wei; unsigned int linetypedata[16]; if ((fp=fopen("hzk16f","rb"))==NULL) { outtextxy(10,10,"can't open HZ16_file!"); exit(0); } qu=byte1-0xa0;wei=byte2-0xa0; p=(qu-1)*94+wei-1;p*=32; fseek(fp,(long)p,SEEK_SET); fread(buf,2,16,fp); fclose(fp); for (i=0;i<16;i++) { linetypedata[i]=(buf[i]<<8&0xff00)|(buf[i]>>8&0x00ff); } x=left+15;setcolor(color); getlinesettings(&oldlinetype); for (i=0,y=top;i<16;i++,y++) { setlinestyle(4,linetypedata[i],1); moveto(left,y); lineto(x,y); } setlinestyle(oldlinetype.linestyle,oldlinetype.upattern,oldlinetype.thickness); return; } int outhz(int x,int y,char *p,int color) { int oldcolor=getcolor(); setcolor(color); while (*p) { if (x>639||y>479) return 0; if (((unsigned char)*p>=0xa1&&(unsigned char)*p<=0xfe)&&((unsigned char)*(p+1)>=0xa1&&(unsigned char)*(p+1)<=0xfe)) { disphz(x,y,*p,*(p+1),color); p+=2; x+=18; moveto(x,y); } else { unsigned char *q[2]; moveto(x,y); *q=*p; *(q+1)='\0'; settextstyle(0,0,1); outtextxy(x,y+4,q); x+=9; p++; } } setcolor(oldcolor); } int main() { int gd=VGA,gm=VGAHI; registerbgidriver(EGAVGA_driver); /*如果你的g没有先编译EGAVGA加到graphics.lib 请注释掉此句*/ initgraph(&gd,&gm,""); outhz(100,100,"你好!测试一下程序ABCabc123",WHITE); outhz(100,120,"同是一颗金星,早上,人们叫它启明,傍晚,人们叫它长庚。",WHITE); getch(); closegraph(); clrscr(); return 0; } |
|
| 第5楼 SinLow | 发表于 2009-09-17 10:26 |
| 初级用户 发帖 33 积分 70 | |
|
谢了,我收了,呵呵!
感谢提供 |
|
|
[ 联系联盟系统管理团队 -
中国DOS联盟 -
标准版 ] Sponsored by ifanr Inc | © 2001–2023 |