📄 gethostname.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>gethostname</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>NAME</h4><blockquote>gethostname - get name of current host</blockquote><h4>SYNOPSIS</h4><blockquote><pre><code>#include <<a href="unistd.h.html">unistd.h</a>>int gethostname(char *<I>name</I>, size_t <I>namelen</I>);</code></pre></blockquote><h4>DESCRIPTION</h4><blockquote>The<i>gethostname()</i>function returns the standard host name for the current machine. The<I>namelen</I> argument specifies the size of the array pointed to by the<I>name</I> argument. The returned name is null-terminated, except that if<I>namelen</I> is an insufficient length to hold the host name, then thereturned name is truncated and it is unspecified whether the returned name isnull-terminated.<p>Host names are limited to 255 bytes.</blockquote><h4>RETURN VALUE</h4><blockquote>On successful completion, 0 is returned. Otherwise, -1 is returned.</blockquote><h4>ERRORS</h4><blockquote>No errors are defined.</blockquote><h4>SEE ALSO</h4><blockquote><i><a href="../xsh/gethostid.html">gethostid()</a></i>(in the <B>XSH</B> specification),<i><a href="../xsh/uname.html">uname()</a></i>,<i><a href="../xsh/unistd.h.html"><unistd.h></a></i>.</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 + -