📄 ttyname_r.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>ttyname</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_010_175"> </a>NAME</h4><blockquote>ttyname, ttyname_r - find pathname of a terminal</blockquote><h4><a name = "tag_000_010_176"> </a>SYNOPSIS</h4><blockquote><pre><code>#include <<a href="unistd.h.html">unistd.h</a>>char *ttyname(int <i>fildes</i>);int ttyname_r(int <i>fildes</i>, char *<i>name</i>, size_t <i>namesize</i>);</code></pre></blockquote><h4><a name = "tag_000_010_177"> </a>DESCRIPTION</h4><blockquote>The<i>ttyname()</i>function returns a pointer to a string containing anull-terminated pathnameof the terminal associated with file descriptor<i>fildes</i>.The return value may point to static data whose content isoverwritten by each call.<p>The<i>ttyname()</i>interface need not be reentrant.<p>The<i>ttyname_r()</i>function stores the null-terminated pathname of theterminal associated with the file descriptor<i>fildes</i>in the character array referenced by<i>name</i>.The array is<i>namesize</i>characters longand should have space for the name and the terminating null character.The maximum length of the terminal name is {TTY_NAME_MAX}.</blockquote><h4><a name = "tag_000_010_178"> </a>RETURN VALUE</h4><blockquote>Upon successful completion,<i>ttyname()</i>returns a pointer to a string. Otherwise, a null pointer is returnedand<i>errno</i>is set to indicate the error.<p>If successful, the<i>ttyname_r()</i>function returns zero.Otherwise, an error number is returned to indicate the error.</blockquote><h4><a name = "tag_000_010_179"> </a>ERRORS</h4><blockquote>The<i>ttyname()</i>function may fail if:<dl compact><dt>[EBADF]<dd>The<i>fildes</i>argument is not a valid file descriptor.<dt>[ENOTTY]<dd>The<i>fildes</i>argument does not refer to a terminal device.</dl><p>The <i>ttyname_r()</i>function may fail if:<dl compact><dt>[EBADF]<dd>The<i>fildes</i>argument is not a valid file descriptor.<dt>[ENOTTY]<dd>The<i>fildes</i>argument does not refer to a tty.<dt>[ERANGE]<dd>The value of<i>namesize</i>is smaller than the length of the stringto be returned including the terminating null character.</dl></blockquote><h4><a name = "tag_000_010_180"> </a>EXAMPLES</h4><blockquote>None.</blockquote><h4><a name = "tag_000_010_181"> </a>APPLICATION USAGE</h4><blockquote>None.</blockquote><h4><a name = "tag_000_010_182"> </a>FUTURE DIRECTIONS</h4><blockquote>None.</blockquote><h4><a name = "tag_000_010_183"> </a>SEE ALSO</h4><blockquote><i><a href="unistd.h.html"><unistd.h></a></i>.</blockquote><h4>DERIVATION</h4><blockquote><i>ttyname()</i> derived from Issue 1 of the SVID.<P><i>ttyname_r()</i> derived from the POSIX Threads Extension (1003.1c-1995).</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 + -