请大家说说bioskey()这个函数的作用,及需要什么相映的头文件

dengcainiao 2003-01-04 05:42:22
谢谢
...全文
271 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
ybwmissyou 2003-01-04
  • 打赏
  • 举报
回复
自己查把,ctrl+F1
dflbin 2003-01-04
  • 打赏
  • 举报
回复
是个BIOS函数,返回键盘扫描码,可以用来控制捕捉键盘,从而处理相应事件
floatbit 2003-01-04
  • 打赏
  • 举报
回复
我也是在CSDN弄明白这个问题,
bioskey()就我理解,是一个接受键盘事件的函数,
并返回键盘的扫描码,如:ESC键是283

程序例:
#include "bios.h"
#include "stdio.h"
#define ESC 283
main()
{
int key;
while(key=bioskey(0))
{ printf("扫描码 = %d,key");
if(key==ESC)goto EXIT;
}
EXIT:
.........

}

gq00001 2003-01-04
  • 打赏
  • 举报
回复
up
popkiler 2003-01-04
  • 打赏
  • 举报
回复
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;
}


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

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

:)
zyjzy2000 2003-01-04
  • 打赏
  • 举报
回复
直接使用BIOS服务的键盘接口
用 法: int bioskey(int cmd);
#include <bios.h>

70,032

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧