Skip to content

Instantly share code, notes, and snippets.

@zhouqiang-cl
Created November 26, 2016 03:44
Show Gist options
  • Save zhouqiang-cl/e5db453bf2bfba5ed75e1da58f4133ad to your computer and use it in GitHub Desktop.
Save zhouqiang-cl/e5db453bf2bfba5ed75e1da58f4133ad to your computer and use it in GitHub Desktop.
终端io
终端io并不是简单的输入输出那么简单,它可以控制调制解调器, 打印机
或其他的字符设备等
终端io主要工作在以下三种模式中
1.默认模式. 终端设备驱动程序一次返回一行(在shell中默认就是这种状态).特殊字符也会被输入到设备中(如^C)
2.原始模式(raw state). 终端设备驱动程序一次返回一个字符,特殊字符不会被输入到设备中去,(vi 用的就是这种模式处理输入和输出(如vi的快捷键等))
3.cbreak 模式. 和 raw state 模式差不多, 但特殊字符也会输入到设备中去, 同时对于特殊字符的处理是抛出特殊的信号
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment