<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Vier unsinged char in einen std::string]]></title><description><![CDATA[<p>Hallo!</p>
<p>Wie mache ich das am schnellsten?</p>
<p>Derzeit mache ich das so:</p>
<pre><code class="language-cpp">char byte1[4];
	char byte2[4];
	char byte3[4];
	char byte4[4];

	_itoa_s((int)ih-&gt;saddr.byte1, byte1, 10);
	_itoa_s((int)ih-&gt;saddr.byte1, byte2, 10);
	_itoa_s((int)ih-&gt;saddr.byte1, byte3, 10);
	_itoa_s((int)ih-&gt;saddr.byte1, byte4, 10);

	std::string ip = byte1;
	ip += &quot;.&quot;;
	ip += byte2;
	ip += &quot;.&quot;;
	ip += byte3;
	ip += &quot;.&quot;;
	ip += byte4;
</code></pre>
<p>ih-&gt;saddr.byte1 ist dabei unsigned char.</p>
<p>Geht doch bestimmt einfacher/schneller?</p>
<p>MfG</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/185899/vier-unsinged-char-in-einen-std-string</link><generator>RSS for Node</generator><lastBuildDate>Thu, 24 Sep 2026 06:16:25 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/185899.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 02 Jul 2007 17:04:20 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Vier unsinged char in einen std::string on Mon, 02 Jul 2007 17:04:20 GMT]]></title><description><![CDATA[<p>Hallo!</p>
<p>Wie mache ich das am schnellsten?</p>
<p>Derzeit mache ich das so:</p>
<pre><code class="language-cpp">char byte1[4];
	char byte2[4];
	char byte3[4];
	char byte4[4];

	_itoa_s((int)ih-&gt;saddr.byte1, byte1, 10);
	_itoa_s((int)ih-&gt;saddr.byte1, byte2, 10);
	_itoa_s((int)ih-&gt;saddr.byte1, byte3, 10);
	_itoa_s((int)ih-&gt;saddr.byte1, byte4, 10);

	std::string ip = byte1;
	ip += &quot;.&quot;;
	ip += byte2;
	ip += &quot;.&quot;;
	ip += byte3;
	ip += &quot;.&quot;;
	ip += byte4;
</code></pre>
<p>ih-&gt;saddr.byte1 ist dabei unsigned char.</p>
<p>Geht doch bestimmt einfacher/schneller?</p>
<p>MfG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1317036</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1317036</guid><dc:creator><![CDATA[ceplusplus@loggedoff]]></dc:creator><pubDate>Mon, 02 Jul 2007 17:04:20 GMT</pubDate></item><item><title><![CDATA[Reply to Vier unsinged char in einen std::string on Mon, 02 Jul 2007 17:19:51 GMT]]></title><description><![CDATA[<p><a href="http://www.mkssoftware.com/docs/man3/inet_ntoa.3.asp" rel="nofollow">http://www.mkssoftware.com/docs/man3/inet_ntoa.3.asp</a><br />
<img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1317046</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1317046</guid><dc:creator><![CDATA[pale dog]]></dc:creator><pubDate>Mon, 02 Jul 2007 17:19:51 GMT</pubDate></item><item><title><![CDATA[Reply to Vier unsinged char in einen std::string on Mon, 02 Jul 2007 17:28:19 GMT]]></title><description><![CDATA[<p>Wenns C++ sein soll oder du den Header nicht hast:</p>
<pre><code class="language-cpp">#include &lt;sstream&gt;
// ...
std::ostringstream os;
os &lt;&lt; int(ih-&gt;saddr.byte1) &lt;&lt; '.' &lt;&lt; int(ih-&gt;saddr.byte2) &lt;&lt; '.' &lt;&lt; int(ih-&gt;saddr.byte3) &lt;&lt; '.' &lt;&lt; int(ih-&gt;saddr.byte4);
</code></pre>
<p>Dann kannst du mit os.str() den string benutzen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1317052</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1317052</guid><dc:creator><![CDATA[.filmor]]></dc:creator><pubDate>Mon, 02 Jul 2007 17:28:19 GMT</pubDate></item><item><title><![CDATA[Reply to Vier unsinged char in einen std::string on Mon, 02 Jul 2007 20:54:48 GMT]]></title><description><![CDATA[<p>Momentmal, einen header sollte ich haben...<br />
Von WinPCap kommen die Daten.</p>
<p>MfG</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1317185</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1317185</guid><dc:creator><![CDATA[ceplusplus@loggedoff]]></dc:creator><pubDate>Mon, 02 Jul 2007 20:54:48 GMT</pubDate></item></channel></rss>