`
zhangziyueup
  • 浏览: 1160864 次
文章分类
社区版块
存档分类
最新评论

bioskey的用法

 
阅读更多
bioskey

Keyboard interface

int bioskey(int cmd);

Prototype in bios.h
cmd Action
0 ?Return key scancode from buffer and
?delete it from the buffer. Wait for
?the next key if the buffer is empty.
?
1 ?Return key scancode from buffer, but
?do not delete it from the buffer.
?Return 0 if the buffer is empty.
?
2 ?Return the BIOS shift state flags.
?


#include <stdio.h>
#include <bios.h>
#include <ctype.h>

#define RIGHT 0x01
#define LEFT 0x02
#define CTRL 0x04
#define ALT 0x08

int main(void)
{
int key, modifiers;

/* function 1 returns 0 until a key is pressed */
while (bioskey(1) == 0);

/* function 0 returns the key that is waiting */
key = bioskey(0);

/* use function 2 to determine if shift keys were used */
modifiers = bioskey(2);
if (modifiers)
{
printf("[");
if (modifiers & RIGHT) printf("RIGHT");
if (modifiers & LEFT) printf("LEFT");
if (modifiers & CTRL) printf("CTRL");
if (modifiers & ALT) printf("ALT");
printf("]");
}
/* print out the character read */
if (isalnum(key & 0xFF))
printf("'%c'/n", key);
else
printf("%#02x/n", key);
return 0;
}


像这些功能最好自己调试一下,利于记忆啊

我就是这样的,调试出真知啊

:)
分享到:
评论

相关推荐

    C语言bioskey返回值大全

    很全面的bioskey返回值,基本上每个键都涵盖了,再也不用到网上各处找了

    键盘扫码大全 C语言bioskey返回值

    键盘扫码大全 c语言 BISO中断 键盘扫码大全 c语言 BISO中断

    bioskey().rar_bioskey_键盘扫描码

    bioskey()函数能返回的所有的键盘扫描码。

    bioskey的算法.doc

    bioskey的算法.doc

    C语言面向对象程序设示例.pdf

    组合输出菜单界面,运用库函数int bioskey(int cmd);键盘接口控制选择操作,int gettext(int left, int top, int right, int bottom, void *destin);输入字符与屏幕位置的字符比较,变换不同的文本背景颜色,

    BIOS服务的键盘接口

    bioskey()返回下一个在键盘键入的值(它将等待到按下一个键)。它返回一个16位 的二进制数,包括两个不同的值。

    通讯录c程序代码

    bioskey(0); &lt;br&gt;do { clrscr(); printf("\n\n\n ********通讯录管理系统********\n\n" ); printf(" 1.创建资料\n\n"); printf(" 2.输出资料\n\n"); printf(" 3.资料查询\n\n"); printf...

    一段获得键盘码的小程序

    for (;;) { key=bioskey(0); /* wait for a keystroke */ printf("0x%x\n",key); if (key==0x11b) break; /* Escape */ }

    C语言编写的电子时钟

    bioskey(1)) { gettime(&tim); sec_radian=(float)tim.ti_sec*((2*PI)/60); min_radian=(float)tim.ti_min*((2*PI)/60); hr_radian=(float)tim.ti_hour*((2*PI)/12)+min_radian/12; setbkcolor(BLACK); ...

    C程序读取键盘码的方法

    本文以一个简单实例讲述了C程序读取键盘码的方法,分享给大家供大家参考。具体分析如下: 一般来说,键盘码在底层开发中经常会用到,有时候我们会忘记它们,就要急急忙忙的去找 键-码 对照表查看,其实程序可以自己...

    c语言turbo-c贪吃蛇,俄罗斯方块

    使用的就是上面的技术 . DOSBox0.74-win32-installer.rar getcolor()颜色参数打印图.jpg key记录.txt Pic20100926_114442.png Pic20100926_115528.png Tc图形函数详解.CHM wintc191.rar 历史代码.rar ─...

    《C语言高级编程与实例剖析》源码

    5.3.2 键盘操作函数bioskey() 207 5.4 鼠标与键盘的综合应用实例 208 5.4.1 需求分析 208 5.4.2 源代码解析 208 5.4.3 运行结果 212 5.4.4 归纳总结 213 5.5 中断应用——菜单制作程序剖析 213 ...

    qiang ---tc

    key = bioskey(0); switch(key) { case 0x4800: aPcaman.direction = UP; break; case 0x5000: aPcaman.direction = DOWN; break; case 0x4b00: ...

    kuang tu--tc

    while(bioskey(1)) { key=bioskey(0); switch(key) { case 0x4800:direction=UP; break; case 0x5000:direction=DOWN; break; case 0x4b00:...

    接口通信程序设计C语言版附带实验报告

    key=bioskey(0); key=key&0xff; } if (index == 0){ ret = 0; strcpy(sendmsg, "_accept"); strcat(sendmsg, "\0"); sendMessage(); } else { ret = 1; strcpy(sendmsg, "_refuse"); strcat(sendmsg, ...

    魔方(C语言)

    key=bioskey(0); /*READ KEYBORD*/ switch(key) { case 283:printf("Esc"); /*IF INPUT_KEY="ESC" TO EXIT THE PROGRAM*/ goto end; case 20480:setcolor(0); /*IF INPUT_KEY="DOWN" TO CHANGE THE ARROW*/ ...

    c 语言原代码 俄罗斯放快

    key=bioskey(0); if(ESC==key) break; top=0; up=4; xm=ym=4; clr(15,10,19,14); drawall(15,10); bar(250,250,290,290); for(i=0;i;i++) for(j=0;j;j++) { itoa(b[ i][j],s,10); moveto(250+i*10,250+j*10); ...

    c语言实现电子时钟课程设计

    if(bioskey(1)!=0){ k=bioskey(0); count=keyhandle(k,count); if(count==5) count=1; } } setcolor(15); digitclock(485,318,digitsec(s)+1);/*数字时钟增加1秒*/ setcolor(12); /*淡红色*/ x2=98*sin...

    五子棋程序代码,wintc编写

    while (bioskey(1) == 0) ;/*如果用户没有按键,空循环*/ press=bioskey(0); lowbyte=press&0xff; press=press&0xff00 + toupper(lowbyte); return(press); } /*落子错误处理*/ void DoError(void) { sound...

    c++语言代码

    #include &lt;graphics.h&gt; #include &lt;stdlib.h&gt; #include &lt;dos.h&gt; #include &lt;conio.h&gt; #include &lt;math.h&gt; #include &lt;malloc.h&gt; #define G 9.8 /*重力加速度*/ #define PI 3.141593 /*圆周率*/ ...

Global site tag (gtag.js) - Google Analytics