📄 console15.txt
字号:
Example:
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#include <linux/kd.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#define ERROR -1
void main()
{
int fd;
register int i;
struct kbkeycode keycode;
if ((fd = open("/dev/console", O_NOCTTY)) == ERROR) {
perror("open");
exit(ERROR);
}
printf("w00w00!\n\n");
keycode.scancode = 1; /* Scancode to convert to keycode. */
while(1) {
if (keycode.scancode > 255) {
putchar('\n');
close(fd);
exit(0);
}
if (ioctl(fd, KDGETKEYCODE, &keycode) == ERROR) {
keycode.scancode++;
continue;
}
printf("Keycode: %d (from scan code %d)\n",
keycode.keycode, keycode.scancode);
keycode.scancode++;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -