搜索
bottom↓
回复: 5

linux终端的一些问题

[复制链接]

出0入0汤圆

发表于 2011-6-10 18:12:03 | 显示全部楼层 |阅读模式
1 tcgetattr(STDIN_FILENO, &term)
这是将获得的终端信息保存到term结构中,这些终端信息是什么呢?
2 saveterm.c_cc[VERASE]='\b';
删除上一个还没有删掉的字符。这是删除'\b'转义字符码?
3 看这些终端信息,linux哪本书籍介绍了这一点,如果有PDF文档,请给一下链接,不甚感谢!

阿莫论坛20周年了!感谢大家的支持与爱护!!

一只鸟敢站在脆弱的枝条上歇脚,它依仗的不是枝条不会断,而是自己有翅膀,会飞。

出0入0汤圆

发表于 2011-6-10 18:50:34 | 显示全部楼层
Please see tcgetattr man page using "man tcgetattr". Or you can visit following url if you are not a *nix user.
http://www.kernel.org/doc/man-pages/online/pages/man3/termios.3.html

And if that stuffs is not enough yet, please see
0.Low-Level Terminal Interface part of "GNU C Library Reference Manual" (Section 17, especially 17.4)
   http://www.gnu.org/software/libc/manual/html_node/Low_002dLevel-Terminal-Interface.html#Low_002dLevel-Terminal-Interface
   
1.http://tldp.org/HOWTO/Text-Terminal-HOWTO.html

2.http://tldp.org/HOWTO/Serial-Programming-HOWTO/

3.http://tldp.org/HOWTO/Serial-HOWTO.html

According your post, I guest you are not a *nix user. Install Linux and use it if you want to be a real *nix programmer.

出0入0汤圆

发表于 2011-6-10 19:21:20 | 显示全部楼层
From termios man page, you can get the information as follow:
================================This is a little piece  from the termios.3 manual page=====================================================
The termios structure

       Many of the functions described here have a termios_p argument that is a
       pointer to a termios structure.  This structure contains at least the
       following members:

           tcflag_t c_iflag;      /* input modes */
           tcflag_t c_oflag;      /* output modes */
           tcflag_t c_cflag;      /* control modes */
           tcflag_t c_lflag;      /* local modes */
           cc_t     c_cc[NCCS];   /* control chars */

----------------------------------------------------------------------
       The c_cc array defines the special control characters.  The symbolic indices
       (initial values) and meaning are:

       VERASE (0177, DEL, rubout, or 010, BS, Ctrl-H, or also #) Erase character.
              This erases the previous not-yet-erased character, but does not erase
              past EOF or beginning-of-line.  Recognized when ICANON is set, and then
              not passed as input.
===================================================     End      ==========================================

'\b' is Character Escape Codes in C programming language. It actually is ASCII[1] code BS (Backspace, numeric 0x08), and works as a
control sequences in VT100 series terminal device. When terminal received BS, it moves cursor to the left one character position,
unless it is at the left margin, in which case no action occurs[2].


[1] http://en.wikipedia.org/wiki/ASCII
[2] http://vt100.net/docs/tp83/appendixb.html

出0入54汤圆

发表于 2011-6-10 19:25:37 | 显示全部楼层
\b是退格符。退一格

出0入0汤圆

 楼主| 发表于 2011-6-17 10:59:24 | 显示全部楼层
谢谢各位。

出0入0汤圆

发表于 2011-6-17 12:24:55 | 显示全部楼层
回复【4楼】fengsunping  
谢谢各位。
-----------------------------------------------------------------------
                                 
回帖提示: 反政府言论将被立即封锁ID 在按“提交”前,请自问一下:我这样表达会给举报吗,会给自己惹麻烦吗? 另外:尽量不要使用Mark、顶等没有意义的回复。不得大量使用大字体和彩色字。【本论坛不允许直接上传手机拍摄图片,浪费大家下载带宽和论坛服务器空间,请压缩后(图片小于1兆)才上传。压缩方法可以在微信里面发给自己(不要勾选“原图),然后下载,就能得到压缩后的图片】。另外,手机版只能上传图片,要上传附件需要切换到电脑版(不需要使用电脑,手机上切换到电脑版就行,页面底部)。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|Archiver|amobbs.com 阿莫电子技术论坛 ( 粤ICP备2022115958号, 版权所有:东莞阿莫电子贸易商行 创办于2004年 (公安交互式论坛备案:44190002001997 ) )

GMT+8, 2024-5-20 17:27

© Since 2004 www.amobbs.com, 原www.ourdev.cn, 原www.ouravr.com

快速回复 返回顶部 返回列表