📄 inet_makeaddr.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"><html><head><!-- Copyright 1997 The Open Group, All Rights Reserved --><title>inet_addr</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>inet_addr, inet_network, inet_makeaddr, inet_lnaof, inet_netof, inet_ntoa - Internet address manipulation</blockquote><h4>SYNOPSIS</h4><blockquote><pre><code>#include <<a href="arpainet.h.html">arpa/inet.h</a>>in_addr_t inet_addr(const char *<I>cp</I>);in_addr_t inet_lnaof(struct in_addr <I>in</I>);struct in_addr inet_makeaddr(in_addr_t <I>net</I>, in_addr_t <I>lna</I>);in_addr_t inet_netof(struct in_addr <I>in</I>);in_addr_t inet_network(const char *<I>cp</I>);char *inet_ntoa(struct in_addr <I>in</I>);</code></pre></blockquote><h4>DESCRIPTION</h4><blockquote>The<i>inet_addr()</i>function converts the string pointed to by <I>cp</I>, in the Internet standarddot notation, to an integer value suitable for use as an Internet address.<p>The<i>inet_lnaof()</i>function takes an Internet host address specified by <I>in</I> and extracts thelocal network address part, in host byte order.<p>The<i>inet_makeaddr()</i>function takes the Internet network number specified by <I>net</I> and thelocal network address specified by <I>lna</I>, both in host byte order, andconstructs an Internet address from them.<p>The<i>inet_netof()</i>function takes an Internet host address specified by <I>in</I> and extracts thenetwork number part, in host byte order.<p>The<i>inet_network()</i>function converts the string pointed to by <I>cp</I>, in the Internet standarddot notation, to an integer value suitable for use as an Internet networknumber.<p>The<i>inet_ntoa()</i>function converts the Internet host address specified by <I>in</I> to a stringin the Internet standard dot notation.<p>All Internet addresses are returned in network order (bytes ordered from leftto right).<p>Values specified using dot notation take one of the following forms:<dl compact><dt>a.b.c.d<dd>When four parts are specified, each is interpreted as a byte of dataand assigned, from left to right, to the four bytes of an Internet address.<dt>a.b.c<dd>When a three-part address is specified, the last part is interpreted asa 16-bit quantity and placed in the rightmost two bytes of the network address.This makes the three-part address format convenient forspecifying Class B network addresses as 128.<I>net</I>.<I>host</I>.<dt>a.b<dd>When a two-part address is supplied, the last part is interpreted as a24-bit quantity and placed in the rightmost three bytes of the network address.This makes the two-part address format convenient forspecifying Class A network addresses as <I>net</I>.<I>host</I>.<dt>a<dd>When only one part is given, the value is stored directly in thenetwork address without any byte rearrangement.</dl><p>All numbers supplied as parts in dot notation may be decimal, octal, orhexadecimal, as specified in the ISO C standard (that is, a leading 0x or 0Ximplies hexadecimal; otherwise, a leading 0 implies octal; otherwise, thenumber is interpreted as decimal).</blockquote><h4>RETURN VALUE</h4><blockquote>Upon successful completion,<i>inet_addr()</i>returns the Internet address.Otherwise, it returns (<B>in_addr_t</B>)(-1).<p>Upon successful completion,<i>inet_network()</i>returns the converted Internet network number.Otherwise, it returns (<B>in_addr_t</B>)(-1).<p>The<i>inet_makeaddr()</i>function returns the constructed Internet address.<p>The<i>inet_lnaof()</i>function returns the local network address part.<p>The<i>inet_netof()</i>function returns the network number.<p>The<i>inet_ntoa()</i>function returns a pointer to the network address in Internet-standard dotnotation.</blockquote><h4>ERRORS</h4><blockquote>No errors are defined.</blockquote><h4>APPLICATION USAGE</h4><blockquote>The return value of<i>inet_ntoa()</i>may point to static data that may be overwritten by subsequent calls to<i>inet_ntoa()</i>.</blockquote><h4>SEE ALSO</h4><blockquote><i><a href="endhostent.html">endhostent()</a></i>,<i><a href="endnetent.html">endnetent()</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 + -