当前位置:  技术问答>linux和unix

tcgetattr(STDIN_FILENO,&term)后term中值的含义

    来源: 互联网  发布时间:2016-06-23

    本文导语:  小弟初学LINUX,看到终端I/O那章,自己写了下面一段代码 int main(void) {         struct termios term;         tcgetattr(STDIN_FILENO,&term);         exit(0); } 然后用gdb停在exit前面,print term后得到下面一串内容: (gdb) print...

小弟初学LINUX,看到终端I/O那章,自己写了下面一段代码

int main(void)
{
        struct termios term;
        tcgetattr(STDIN_FILENO,&term);
        exit(0);

}
然后用gdb停在exit前面,print term后得到下面一串内容:
(gdb) print term
$1 = {c_iflag = 1280, c_oflag = 5, c_cflag = 191, c_lflag = 35387, c_line = 0 '', 
  c_cc = "033417725040001002123320022172726", '' , c_ispeed = 15, c_ospeed = 15}

怎么标记位的值都是数字啊?不应该是英文标志的吗?数字代表什么意思呢
那个c_cc中的数字又代表什么呢?  菜鸟问题,哪位大哥帮忙解答下哈

|
打开/usr/include/termios.h查看定义: 
比如c_iflag的值 
C/C++ code
/*
 * Input flags - software input processing
 */
#define IGNBRK          0x00000001      /* ignore BREAK condition */
#define BRKINT          0x00000002      /* map BREAK to SIGINTR */
#define IGNPAR          0x00000004      /* ignore (discard) parity errors */
#define PARMRK          0x00000008      /* mark parity and framing errors */
#define INPCK           0x00000010      /* enable checking of parity errors */
#define ISTRIP          0x00000020      /* strip 8th bit off chars */
#define INLCR           0x00000040      /* map NL into CR */
#define IGNCR           0x00000080      /* ignore CR */
#define ICRNL           0x00000100      /* map CR to NL (ala CRMOD) */
#define IXON            0x00000200      /* enable output flow control */
#define IXOFF           0x00000400      /* enable input flow control */
#ifndef _POSIX_SOURCE
#define IXANY           0x00000800      /* any char will restart after stop */
#define IMAXBEL         0x00002000      /* ring bell on input queue full */


注意,不同的系统数值可能是不同的 

    
 
 
 
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。












  • 相关文章推荐
  • 调用linux的tcgetattr函数去却出现Input/Output error
  • 使用tcgetattr函数与tcsetattr函数的问题


  • 站内导航:


    特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

    ©2012-2021,,E-mail:www_#163.com(请将#改为@)

    浙ICP备11055608号-3