📄 htons.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>htonl</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>htonl, htons, ntohl, ntohs - convert values between host and network byte order</blockquote><h4>SYNOPSIS</h4><blockquote><pre><code>#include <<a href="arpainet.h.html">arpa/inet.h</a>>uint32_t htonl(uint32_t hostlong);uint16_t htons(uint16_t hostshort);uint32_t ntohl(uint32_t netlong);uint16_t ntohs(uint16_t netshort);</code></pre></blockquote><h4>DESCRIPTION</h4><blockquote>These functions convert 16-bit and 32-bit quantities between network byteorder and host byte order.<p>The <B>uint32_t</B>and <B>uint16_t</B>types are made available by inclusion of<i><a href="../xsh/inttypes.h.html"><inttypes.h></a></i>(see referenced document<B>XSH</B>).</blockquote><h4>RETURN VALUES</h4><blockquote>The<i>htonl()</i>and<i>htons()</i>functions return the argument value converted from host to network byte order.<p>The<i><a href="ntohl.html">ntohl()</a></i>and<i>ntohs()</i>functions return the argument value converted from network to host byte order.</blockquote><h4>ERRORS</h4><blockquote>No errors are defined.</blockquote><h4>APPLICATION USAGE</h4><blockquote>These functions are most often used in conjunction with Internetaddresses and ports as returned by<i><a href="gethostent.html">gethostent()</a></i>and<i><a href="getservent.html">getservent()</a></i>.<p>On some architectures these functions are defined as macros that expand to thevalue of their argument.</blockquote><h4>SEE ALSO</h4><blockquote><i><a href="endhostent.html">endhostent()</a></i>,<i><a href="endservent.html">endservent()</a></i>,<i><a href="arpainet.h.html"><arpa/inet.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 + -