请输入您要查询的百科知识:

 

词条 bioskey
释义

§ 函数名

bioskey

§ 功能

直接使用BIOS服务的键盘接口

§ 函数语法

int bioskey(int cmd);

§ 程序演示

#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'\", key);

else

printf("%#02x\", key);

return 0;

}

随便看

 

百科全书收录594082条中文百科知识,基本涵盖了大多数领域的百科知识,是一部内容开放、自由的电子版百科全书。

 

Copyright © 2004-2023 Cnenc.net All Rights Reserved
更新时间:2024/12/20 3:47:29