📄 console10.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 argc, char **argv)
{
int fd;
long mode;
if (argc < 2) {
printf("Usage: %s <mode>\n\n", argv[0]);
printf("Possible modes are:\n");
printf("0x00 for raw mode\n");
printf("0x01 for xlate mode (the default keyboard mode)\n");
printf("0x02 for medium raw mode\n");
printf("0x03 for Unicode mode\n\n");
exit(1);
}
/* To be used as the fd in ioctl(). */
if ((fd = open("/dev/console", O_NOCTTY)) == ERROR) {
perror("open");
exit(ERROR);
}
printf("w00w00!\n\n");
mode = atoi(argv[1]);
if ((ioctl(fd, KDSKBMODE, mode)) == ERROR) {
perror("ioctl");
close(fd);
exit(ERROR);
}
printf("Setting keyboard to ");
if (mode == K_RAW) printf("raw mode.\n");
else if (mode == K_XLATE) printf("xlate mode.\n");
else if (mode == K_MEDIUMRAW) printf("medium raw mode.\n");
else if (mode == K_UNICODE) printf("Unicode mode.\n");
else printf("0x0%x\n", mode); /* For future modes.\n");
close(fd);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -