⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 console21.txt

📁 linux/kd.h文件中介绍了ioctl函数能够使用的命令
💻 TXT
字号:
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 argc, char **argv)
	{
          int fd;
          struct vt_sizes sizes;

	  printf("w00w00!\n\n");

          if (argc < 3) {
             printf("Usage: %s <rows> <cols>\n", argv[0]);
             printf("rows is the number of rows in the console\n");
             printf("cols is the number of columns in the console\n\n");
             exit(1);
          }

	  if ((fd = open("/dev/console", O_NOCTTY)) == ERROR) {
	     perror("open");
	     exit(ERROR);
	  }

          sizes.v_rows = atoi(argv[1]);
          sizes.v_cols = atoi(argv[2]);

          if (ioctl(fd, VT_RESIZE, &sizes) == ERROR) {
             perror("ioctl");
	     close(fd);
	     exit(ERROR);
          }

          printf("Kernel's idea of screensize is now:\n");
          printf("Rows: %d, Columns: %d\n", sizes.v_rows, sizes.v_cols);
          close(fd);
      }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -