【发布时间】:2014-02-20 03:25:42
【问题描述】:
在 Unix 中,某些键的默认设置因平台而异。例如,在 Ubuntu 中擦除可能是 erase = ^?。但是,对于 AIX,它可能与示例 erase = ^H 完全不同。如何检查 C 中的 stty 设置?
这是我试图写的
#include<stdio.h>
#include<stdlib.h>
#include<termios.h>
#include<unistd.h>
int main()
{
struct termios term;
if(tcgetattr(STDIN_FILENO, &term) < 0)
{
printf("Error to get terminal attr\n");
}
printf("The value for Erase is %s\n",term.c_cc[ERASE]);
return 0;
}
使用 gcc 编译后。它说 ERASE 未声明。那么我应该使用的正确选项或变量是什么?
【问题讨论】: