在TC图形模式下,有输出英文字符的函数可用,但没有输入字符的函数~~WHY???
如果在TC图形模式下输入英文字符都困难,想要输入汉字到底行不行?怎么做呢?
下面的源代码是网上找来的.请高手看下有什么问题,多谢.
/*在图形方式下显示输入的字符,仅支持英文字符、数字、退格及回车键,并以回车健结束输入~~*/
#include "stdio.h"
#include <graphics.h>
#include "bios.h"
main()
{ int gd,gm,i=0,key,x,y;
char name[20],ch;
gd=DETECT;
registerbgidriver(EGAVGA_driver);
initgraph(&gd,&gm,"");
setbkcolor(3);
setcolor(6);
setfillstyle(1,6);
bar3d(150,200,450,230,0,0);
setcolor(10);
settextstyle(0,0,1);
outtextxy(152,210,"please input your name:");
do
{ key=bioskey(0);
switch(key)
{ case 0x1e41: ch='a';break;
case 0x3042: ch='b';break;
case 0x2e43: ch='c';break;
case 0x2044: ch='d';break;
case 0x1245: ch='e';break;
case 0x2146: ch='f';break;
case 0x2247: ch='g';break;
case 0x2348: ch='h';break;
case 0x1749: ch='i';break;
case 0x244a: ch='j';break;
case 0x254b: ch='k';break;
case 0x264c: ch='l';break;
case 0x324d: ch='m';break;
case 0x314e: ch='n';break;
case 0x184f: ch='o';break;
case 0x1950: ch='p';break;
case 0x1051: ch='q';break;
case 0x1352: ch='r';break;
case 0x1f53: ch='s';break;
case 0x1454: ch='t';break;
case 0x1655: ch='u';break;
case 0x2f56: ch='v';break;
case 0x1157: ch='w';break;
case 0x2d58: ch='x';break;
case 0x1559: ch='y';break;
case 0x2c5a: ch='z';break;
case 0x1e61: ch='a';break;
case 0x3062: ch='b';break;
case 0x2e63: ch='c';break;
case 0x2064: ch='d';break;
case 0x1265: ch='e';break;
case 0x2166: ch='f';break;
case 0x2267: ch='g';break;
case 0x2368: ch='h';break;
case 0x1769: ch='i';break;
case 0x246a: ch='j';break;
case 0x256b: ch='k';break;
case 0x266c: ch='l';break;
case 0x326d: ch='m';break;
case 0x316e: ch='n';break;
case 0x186f: ch='o';break;
case 0x1970: ch='p';break;
case 0x1071: ch='q';break;
case 0x1372: ch='r';break;
case 0x1f73: ch='s';break;
case 0x1474: ch='t';break;
case 0x1675: ch='u';break;
case 0x2f76: ch='v';break;
case 0x1177: ch='w';break;
case 0x2d78: ch='x';break;
case 0x1579: ch='y';break;
case 0x2c7a: ch='z';break;
case 0x5230:
case 0xb30: ch='0';break;
case 0x4f31:
case 0x231: ch='1';break;
case 0x5032:
case 0x332: ch='2';break;
case 0x5133:
case 0x433: ch='3';break;
case 0x4b34:
case 0x534: ch='4';break;
case 0x4c35:
case 0x635: ch='5';break;
case 0x4d36:
case 0x736: ch='6';break;
case 0x4737:
case 0x837: ch='7';break;
case 0x4838:
case 0x938: ch='8';break;
case 0x4939:
case 0xa39: ch='9';break;
}
name[i++]=ch;
}while ( ch!='\n');
x=getmaxx()/10;
y=getmaxy()/10;
setcolor(15);
settextstyle(1, 0, 15);
outtextxy(x*4, y*4+32, name);
getch();
closegraph();
}