<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://spectrum.alioth.net/doc/index.php?action=history&amp;feed=atom&amp;title=Long2ipstring</id>
	<title>Long2ipstring - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://spectrum.alioth.net/doc/index.php?action=history&amp;feed=atom&amp;title=Long2ipstring"/>
	<link rel="alternate" type="text/html" href="https://spectrum.alioth.net/doc/index.php?title=Long2ipstring&amp;action=history"/>
	<updated>2026-05-14T00:35:17Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>https://spectrum.alioth.net/doc/index.php?title=Long2ipstring&amp;diff=185&amp;oldid=prev</id>
		<title>Winston: New page: '''long2ipstring (IXCALL 0x3E39)''' - convert a 4 byte big endian value to a null-terminated dotted decimal IP string  '''ipstring2long (IXCALL 0x3E3C)''' - convert a dotted decimal IP str...</title>
		<link rel="alternate" type="text/html" href="https://spectrum.alioth.net/doc/index.php?title=Long2ipstring&amp;diff=185&amp;oldid=prev"/>
		<updated>2008-08-31T18:40:35Z</updated>

		<summary type="html">&lt;p&gt;New page: &amp;#039;&amp;#039;&amp;#039;long2ipstring (IXCALL 0x3E39)&amp;#039;&amp;#039;&amp;#039; - convert a 4 byte big endian value to a null-terminated dotted decimal IP string  &amp;#039;&amp;#039;&amp;#039;ipstring2long (IXCALL 0x3E3C)&amp;#039;&amp;#039;&amp;#039; - convert a dotted decimal IP str...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;'''long2ipstring (IXCALL 0x3E39)''' - convert a 4 byte big endian value to a null-terminated dotted decimal IP string&lt;br /&gt;
&lt;br /&gt;
'''ipstring2long (IXCALL 0x3E3C)''' - convert a dotted decimal IP string to a 4 byte big endian value&lt;br /&gt;
&lt;br /&gt;
== Synopsis ==&lt;br /&gt;
&lt;br /&gt;
''Assembly language''&lt;br /&gt;
&lt;br /&gt;
    ld hl, ipstring&lt;br /&gt;
    ld de, inetaddr&lt;br /&gt;
    ld ix, IPSTRING2LONG&lt;br /&gt;
    call IXCALL&lt;br /&gt;
    jr c, .error&lt;br /&gt;
 &lt;br /&gt;
    ld hl, inetaddr&lt;br /&gt;
    ld de, ipstring&lt;br /&gt;
    ld ix, LONG2IPSTRING&lt;br /&gt;
    call IXCALL&lt;br /&gt;
&lt;br /&gt;
''C''&lt;br /&gt;
&lt;br /&gt;
    #include &amp;lt;sys/types.h&amp;gt;&lt;br /&gt;
    #include &amp;lt;spectranet.h&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
    void long2ipstring(in_addr_t *inetaddr, char *ipstring);&lt;br /&gt;
    int ipstring2long(char *ipstring, in_addr_t *inetaddr);&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
The '''long2ipstring()''' and '''ipstring2long()''' functions convert a 4 byte big endian value to a null terminated dotted decimal string and vice versa. For the long2ipstring() function, the pointer to the string buffer must be large enough to receive 17 bytes of data (up to 16 bytes of dotted decimal IP address, plus the null terminator). The same is true for the memory pointed to by the DE register pair when using the assembly language interface.&lt;br /&gt;
&lt;br /&gt;
== Return values ==&lt;br /&gt;
&lt;br /&gt;
The '''ipstring2long()''' function returns 0 on success, or -1 if the supplied string was not a valid dotted decimal IP address. The assembly language interface returns with the carry flag reset on success, or carry set if the supplied string was not valid.&lt;br /&gt;
&lt;br /&gt;
[[Category:Spectranet]]&lt;/div&gt;</summary>
		<author><name>Winston</name></author>
	</entry>
</feed>