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

📄 termios.h.html

📁 unix 下的C开发手册,还用详细的例程。
💻 HTML
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>&lt;termios.h&gt;</title></head><body bgcolor=white><center><font size=2>The Single UNIX &reg; Specification, Version 2<br>Copyright &copy; 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_000_009_537">&nbsp;</a>NAME</h4><blockquote>termios.h - define values for termios</blockquote><h4><a name = "tag_000_009_538">&nbsp;</a>SYNOPSIS</h4><blockquote><pre><code>#include &lt;termios.h&gt;</code></pre></blockquote><h4><a name = "tag_000_009_539">&nbsp;</a>DESCRIPTION</h4><blockquote>The<i>&lt;termios.h&gt;</i>header contains the definitions used by the terminal I/O interfaces(see the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b>&nbsp;</a> for the structures and names defined).<h5><a name = "tag_000_009_539_001">&nbsp;</a>The termios Structure</h5>The following data types are defined through<b>typedef</b>:<dl compact><dt><b>cc_t</b><dd><index term="data type, cc_t"></index>Used for terminal special characters.<dt><b>speed_t</b><dd><index term="data type, speed_t"></index>Used for terminal baud rates.<dt><b>tcflag_t</b><dd><index term="data type, tcflag_t"></index>Used for terminal modes.</dl><p>The above types are all unsigned integral types.<p>The<b>termios</b>structure is defined, and includes at least the following members:<pre><code>tcflag_t  c_iflag     input modestcflag_t  c_oflag     output modestcflag_t  c_cflag     control modestcflag_t  c_lflag     local modescc_t      c_cc[NCCS]  control chars</code></pre><p>A definition is given for:<dl compact><dt>NCCS<dd>Size of the array<b>c_cc</b>for control characters.</dl><p>The following subscript names for the array<b>c_cc</b>are defined:<p><table  bordercolor=#000000 border=1 align=center><tr valign=top><th colspan=2 align=center><b>Subscript Usage</b><th align=left>&nbsp;<tr valign=top><th align=center><b>Canonical Mode</b><th align=center><b>Non-canonical Mode</b><th align=center><b>Description</b><tr valign=top><td align=left>VEOF<td align=left>&nbsp;<td align=left>EOF character<tr valign=top><td align=left>VEOL<td align=left>&nbsp;<td align=left>EOL character<tr valign=top><td align=left>VERASE<td align=left>&nbsp;<td align=left>ERASE character<tr valign=top><td align=left>VINTR<td align=left>VINTR<td align=left>INTR character<tr valign=top><td align=left>VKILL<td align=left>&nbsp;<td align=left>KILL character<tr valign=top><td align=left>&nbsp;<td align=left>VMIN<td align=left>MIN value<tr valign=top><td align=left>VQUIT<td align=left>VQUIT<td align=left>QUIT character<tr valign=top><td align=left>VSTART<td align=left>VSTART<td align=left>START character<tr valign=top><td align=left>VSTOP<td align=left>VSTOP<td align=left>STOP character<tr valign=top><td align=left>VSUSP<td align=left>VSUSP<td align=left>SUSP character<tr valign=top><td align=left><td align=left>VTIME<td align=left>TIME value</table>The subscript values are unique, except that the VMIN and VTIMEsubscripts may have the same values as the VEOF and VEOL subscripts,respectively.<h5><a name = "tag_000_009_539_002">&nbsp;</a>Input Modes</h5>The<b>c_iflag</b>field describes the basic terminal input control:<dl compact><dt>BRKINT<dd>Signal interrupt on break.<dt>ICRNL<dd>Map CR to NL on input.<dt>IGNBRK<dd>Ignore break condition.<dt>IGNCR<dd>Ignore CR<dt>IGNPAR<dd>Ignore characters with parity errors.<dt>INLCR<dd>Map NL to CR on input.<dt>INPCK<dd>Enable input parity check.<dt>ISTRIP<dd>Strip character<dt>IUCLC<dd>Map upper-case to lower-case on input(<b>LEGACY</b>).<dt>IXANY<dd>Enable any character to restart output.<dt>IXOFF<dd>Enable start/stop input control.<dt>IXON<dd>Enable start/stop output control.<dt>PARMRK<dd>Mark parity errors.</dl><h5><a name = "tag_000_009_539_003">&nbsp;</a>Output Modes</h5>The<b>c_oflag</b>field specifies the system treatment of output:<dl compact><dt>OPOST<dd>Post-process output<dt>OLCUC<dd>Map lower-case to upper-case on output(<b>LEGACY</b>).<dt>ONLCR<dd>Map NL to CR-NL on output.<dt>OCRNL<dd>Map CR to NL on output.<dt>ONOCR<dd>No CR output at column 0.<dt>ONLRET<dd>NL performs CR function.<dt>OFILL<dd>Use fill characters for delay.<dt>NLDLY<dd>Select newline delays:<dl compact><dt>NL0<dd>Newline character type 0.<dt>NL1<dd>Newline character type 1.</dl><p><p><dt>CRDLY<dd>Select carriage-return delays:<dl compact><dt>CR0<dd>Carriage-return delay type 0.<dt>CR1<dd>Carriage-return delay type 1.<dt>CR2<dd>Carriage-return delay type 2.<dt>CR3<dd>Carriage-return delay type 3.</dl><p><p><dt>TABDLY<dd>Select horizontal-tab delays:<dl compact><dt>TAB0<dd>Horizontal-tab delay type 0.<dt>TAB1<dd>Horizontal-tab delay type 1.<dt>TAB2<dd>Horizontal-tab delay type 2.<dt>TAB3<dd>Expand tabs to spaces.</dl><p><p><dt>BSDLY<dd>Select backspace delays:<dl compact><dt>BS0<dd>Backspace-delay type 0.<dt>BS1<dd>Backspace-delay type 1.</dl><p><p><dt>VTDLY<dd>Select vertical-tab delays:<dl compact><dt>VT0<dd>Vertical-tab delay type 0.<dt>VT1<dd>Vertical-tab delay type 1.</dl><p><p><dt>FFDLY<dd>Select form-feed delays:<dl compact><dt>FF0<dd>Form-feed delay type 0.<dt>FF1<dd>Form-feed delay type 1.</dl><p></dl><h5><a name = "tag_000_009_539_004">&nbsp;</a>Baud Rate Selection</h5>The input and output baud rates are stored in the<b>termios</b>structure.  These are the valid values for objects of type<b>speed_t</b>.The following values are defined, but not all baud rates need besupported by the underlying hardware.<dl compact><dt>B0<dd>Hang up<dt>B50<dd>50 baud<dt>B75<dd>75 baud<dt>B110<dd>110 baud<dt>B134<dd>134.5 baud<dt>B150<dd>150 baud<dt>B200<dd>200 baud<dt>B300<dd>300 baud<dt>B600<dd>600 baud<dt>B1200<dd>1200 baud<dt>B1800<dd>1800 baud<dt>B2400<dd>2400 baud<dt>B4800<dd>4800 baud<dt>B9600<dd>9600 baud<dt>B19200<dd>19200 baud<dt>B38400<dd>38400 baud</dl><h5><a name = "tag_000_009_539_005">&nbsp;</a>Control Modes</h5>The<b>c_cflag</b>field describes the hardware control of the terminal; not all valuesspecified are required to be supported by the underlying hardware:<dl compact><dt>CSIZE<dd>Character size:<dl compact><dt>CS5<dd>5 bits.<dt>CS6<dd>6 bits.<dt>CS7<dd>7 bits.<dt>CS8<dd>8 bits.</dl><p><p><dt>CSTOPB<dd>Send two stop bits, else one.<p><dt>CREAD<dd>Enable receiver.<p><dt>PARENB<dd>Parity enable.<p><dt>PARODD<dd>Odd parity, else even.<p><dt>HUPCL<dd>Hang up on last close.<p><dt>CLOCAL<dd>Ignore modem status lines.<p></dl><h5><a name = "tag_000_009_539_006">&nbsp;</a>Local Modes</h5>The<b>c_lflag</b>field of the argument structureis used to control various terminal functions:<dl compact><dt>ECHO<dd>Enable echo.<dt>ECHOE<dd>Echo erase character as error-correcting backspace.<dt>ECHOK<dd>Echo KILL.<dt>ECHONL<dd>Echo NL.<dt>ICANON<dd>Canonical input (erase and kill processing).<dt>IEXTEN<dd>Enable extended input character processing.<dt>ISIG<dd>Enable signals.<dt>NOFLSH<dd>Disable flush after interrupt or quit.<dt>TOSTOP<dd>Send SIGTTOU for background output.<dt>XCASE<dd>Canonical upper/lower presentation(<b>LEGACY</b>).</dl><h5><a name = "tag_000_009_539_007">&nbsp;</a>Attribute Selection</h5>The following symbolic constants for use with<i><a href="tcsetattr.html">tcsetattr()</a></i>are defined:<dl compact><dt>TCSANOW<dd>Change attributes immediately.<dt>TCSADRAIN<dd>Change attributes when output has drained.<dt>TCSAFLUSH<dd>Change attributes when output has drained; also flush pending input.</dl><h5><a name = "tag_000_009_539_008">&nbsp;</a>Line Control</h5>The following symbolic constants for use with<i><a href="tcflush.html">tcflush()</a></i>are defined:<dl compact><dt>TCIFLUSH<dd>Flush pending input.Flush untransmitted output.<dt>TCIOFLUSH<dd>Flush both pending input and untransmitted output.<dt>TCOFLUSH<dd>Flush untransmitted output.</dl><p>The following symbolic constants for use with<i><a href="tcflow.html">tcflow()</a></i>are defined:<dl compact><dt>TCIOFF<dd>Transmit a STOP character, intended to suspend input data.<dt>TCION<dd>Transmit a START character, intended to restart input data.<dt>TCOOFF<dd>Suspend output.<dt>TCOON<dd>Restart output.</dl><p>The following are declared as functions and may also be definedas macros.Function prototypes must be provided for use with an ISO Ccompiler.<pre><code>speed_t <a href="cfgetispeed.html">cfgetispeed</a>(const struct termios *);speed_t <a href="cfgetospeed.html">cfgetospeed</a>(const struct termios *);int     <a href="cfsetispeed.html">cfsetispeed</a>(struct termios *, speed_t);int     <a href="cfsetospeed.html">cfsetospeed</a>(struct termios *, speed_t);int     <a href="tcdrain.html">tcdrain</a>(int);int     <a href="tcflow.html">tcflow</a>(int, int);int     <a href="tcflush.html">tcflush</a>(int, int);int     <a href="tcgetattr.html">tcgetattr</a>(int, struct termios *);pid_t   <a href="tcgetsid.html">tcgetsid</a>(int);int     <a href="tcsendbreak.html">tcsendbreak</a>(int, int);int     <a href="tcsetattr.html">tcsetattr</a>(int, int, struct termios *);</code></pre></blockquote><h4><a name = "tag_000_009_540">&nbsp;</a>APPLICATION USAGE</h4><blockquote>The following names are commonly used as extensions to the above,therefore portable applications must not use them:<p><table <tr valign=top><th align=left>CBAUD<th align=left>EXTB<th align=left>VDSUSP<tr valign=top><td align=left>DEFECHO<td align=left>FLUSHO<td align=left>VLNEXT<tr valign=top><td align=left>ECHOCTL<td align=left>LOBLK<td align=left>VREPRINT<tr valign=top><td align=left>ECHOKE<td align=left>PENDIN<td align=left>VSTATUS<tr valign=top><td align=left>ECHOPRT<td align=left>SWTCH<td align=left>VWERASE<tr valign=top><td align=left>EXTA<td align=left>VDISCARD<td align=left></table></blockquote><h4><a name = "tag_000_009_541">&nbsp;</a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_000_009_542">&nbsp;</a>SEE ALSO</h4><blockquote><i><a href="cfgetispeed.html">cfgetispeed()</a></i>,<i><a href="cfgetospeed.html">cfgetospeed()</a></i>,<i><a href="cfsetispeed.html">cfsetispeed()</a></i>,<i><a href="cfsetospeed.html">cfsetospeed()</a></i>,<i><a href="tcdrain.html">tcdrain()</a></i>,<i><a href="tcflow.html">tcflow()</a></i>,<i><a href="tcflush.html">tcflush()</a></i>,<i><a href="tcgetattr.html">tcgetattr()</a></i>,<i><a href="tcgetsid.html">tcgetsid()</a></i>,<i><a href="tcsendbreak.html">tcsendbreak()</a></i>,<i><a href="tcsetattr.html">tcsetattr()</a></i>,the <b>XBD</b> specification, <a href="../xbd/termios.html"><b>General Terminal Interface</b>&nbsp;</a>.</blockquote><hr size=2 noshade><center><font size=2>UNIX &reg; is a registered Trademark of The Open Group.<br>Copyright &copy; 1997 The Open Group<br> [ <a href="../index.html">Main Index</a> | <a href="../xshix.html">XSH</a> | <a href="../xcuix.html">XCU</a> | <a href="../xbdix.html">XBD</a> | <a href="../cursesix.html">XCURSES</a> | <a href="../xnsix.html">XNS</a> ]</font></center><hr size=2 noshade></body></html>

⌨️ 快捷键说明

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