📄 ctermid.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>ctermid</title></head><body bgcolor=white><center><font size=2>The Single UNIX ® Specification, Version 2<br>Copyright © 1997 The Open Group</font></center><hr size=2 noshade><h4><a name = "tag_000_002_056"> </a>NAME</h4><blockquote>ctermid - generate a pathname for controlling terminal</blockquote><h4><a name = "tag_000_002_057"> </a>SYNOPSIS</h4><blockquote><pre><code>#include <<a href="stdio.h.html">stdio.h</a>>char *ctermid(char *<i>s</i>);</code></pre></blockquote><h4><a name = "tag_000_002_058"> </a>DESCRIPTION</h4><blockquote>The<i>ctermid()</i>function generates a string that, when used as a pathname, refersto the current controlling terminal for the current process.If<i>ctermid()</i>returns a pathname, access to the file is notguaranteed.<p>If the application uses any of the _POSIX_THREAD_SAFE_FUNCTIONS or _POSIX_THREADS interfaces, the<i>ctermid()</i>function must be called with a non-NULL parameter.</blockquote><h4><a name = "tag_000_002_059"> </a>RETURN VALUE</h4><blockquote>If<i>s</i>is a null pointer, the string is generated in an area that may bestatic (and therefore may be overwritten by each call), theaddress of which is returned.Otherwise<i>s</i>is assumed to point to a character arrayof at least {L_ctermid}bytes; the string is placed in this array and the value of<i>s</i>is returned.The symbolic constant {L_ctermid}is defined in<i><a href="stdio.h.html"><stdio.h></a></i>,and will have a value greater than 0.<p>The<i>ctermid()</i>function will return an empty string if the pathname that wouldrefer to the controlling terminal cannot be determined, or if thefunction is unsuccessful.</blockquote><h4><a name = "tag_000_002_060"> </a>ERRORS</h4><blockquote>No errors are defined.</blockquote><h4><a name = "tag_000_002_061"> </a>EXAMPLES</h4><blockquote>None.</blockquote><h4><a name = "tag_000_002_062"> </a>APPLICATION USAGE</h4><blockquote>The difference between<i>ctermid()</i>and<i><a href="ttyname.html">ttyname()</a></i>is that<i><a href="ttyname.html">ttyname()</a></i>must be handed a file descriptor and returns a path ofthe terminal associated with that file descriptor, while<i>ctermid()</i>returns a string(such as<i>/dev/tty</i>)that will refer to thecurrent controlling terminal if used as a pathname.</blockquote><h4><a name = "tag_000_002_063"> </a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_000_002_064"> </a>SEE ALSO</h4><blockquote><i><a href="ttyname.html">ttyname()</a></i>,<i><a href="stdio.h.html"><stdio.h></a></i>.</blockquote><h4>DERIVATION</h4><blockquote>Derived from Issue 1 of the SVID.</blockquote><hr size=2 noshade><center><font size=2>UNIX ® is a registered Trademark of The Open Group.<br>Copyright © 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 + -