console18.txt
来自「linux/kd.h文件中介绍了ioctl函数能够使用的命令」· 文本 代码 · 共 36 行
TXT
36 行
Example
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#include <linux/vt.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#define ERROR -1
void main()
{
int fd;
struct vt_stat stat;
printf("w00w00!\n\n");
/* used as fd for ioctl() */
if ((fd = open("/dev/tty", O_NOCTTY)) == ERROR) {
perror("open");
exit(ERROR);
}
if (ioctl(fd, VT_GETSTATE, &stat) == ERROR) {
perror("ioctl");
close(fd);
exit(ERROR);
}
printf("Current VT: tty%d\n", stat.v_active);
printf("Signal to send: %d\n", stat.v_signal);
printf("VT bitmask: %d\n", stat.v_state);
close(fd);
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?