<?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[int to string Umwandlung]]></title><description><![CDATA[<p>Hallo,</p>
<p>wie kann man einen int-Wert in einen string-Wert umwandeln, zum Beispiel für GUI-Anwendungen?<br />
Also etwa so:</p>
<pre><code class="language-cpp">int aint = 1; string astring;
Umwandelfunktion(aint, astring);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/topic/173745/int-to-string-umwandlung</link><generator>RSS for Node</generator><lastBuildDate>Fri, 18 Sep 2026 09:32:18 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/173745.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 19 Feb 2007 14:17:53 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to int to string Umwandlung on Mon, 19 Feb 2007 14:17:53 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>wie kann man einen int-Wert in einen string-Wert umwandeln, zum Beispiel für GUI-Anwendungen?<br />
Also etwa so:</p>
<pre><code class="language-cpp">int aint = 1; string astring;
Umwandelfunktion(aint, astring);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1231243</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1231243</guid><dc:creator><![CDATA[Thracian]]></dc:creator><pubDate>Mon, 19 Feb 2007 14:17:53 GMT</pubDate></item><item><title><![CDATA[Reply to int to string Umwandlung on Mon, 19 Feb 2007 14:20:06 GMT]]></title><description><![CDATA[<p>FAQ: <a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-39488.html" rel="nofollow">http://www.c-plusplus.net/forum/viewtopic-var-t-is-39488.html</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1231244</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1231244</guid><dc:creator><![CDATA[viande]]></dc:creator><pubDate>Mon, 19 Feb 2007 14:20:06 GMT</pubDate></item><item><title><![CDATA[Reply to int to string Umwandlung on Mon, 19 Feb 2007 14:21:12 GMT]]></title><description><![CDATA[<p>Guck mal im folgenden FAQ-Beitrag:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic-var-t-is-39488.html" rel="nofollow">Einmal Zahl nach String und zurück</a></p>
<p>Greetz</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1231245</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1231245</guid><dc:creator><![CDATA[Vellas]]></dc:creator><pubDate>Mon, 19 Feb 2007 14:21:12 GMT</pubDate></item><item><title><![CDATA[Reply to int to string Umwandlung on Mon, 19 Feb 2007 14:31:11 GMT]]></title><description><![CDATA[<p>OK, vielen Dank.<br />
Hatte ich mit der Suchenfunktion leider nicht gefunden.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1231256</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1231256</guid><dc:creator><![CDATA[Thracian]]></dc:creator><pubDate>Mon, 19 Feb 2007 14:31:11 GMT</pubDate></item><item><title><![CDATA[Reply to int to string Umwandlung on Mon, 19 Feb 2007 15:27:57 GMT]]></title><description><![CDATA[<p>Hmm kann sein das ich gerade nen Dekkel vorm Kopp hab, aber folgendes ist nicht so sinnvoll:</p>
<pre><code class="language-cpp">#include &lt;sstream&gt;
#include &lt;string&gt;
#include &lt;iostream&gt;

int main()
{
    unsigned int i = 2;
    std::ostringstream ss;
    ss &lt;&lt; i;
    std::string string(ss.str());
    std::cout &lt;&lt; string &lt;&lt; std::endl;
}
</code></pre>
<p>denn das o in std::ostringstream steht ja eigentlich für out und man gibt nur den Integer i rein, folglich müsste es eigentlich std::istringstream heißen ... da str() kein Streamoperator ist ... sondern eine normale Funktion ... kann jetzt aber auch sein das ich müll erzähle ^^</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1231308</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1231308</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Mon, 19 Feb 2007 15:27:57 GMT</pubDate></item><item><title><![CDATA[Reply to int to string Umwandlung on Mon, 19 Feb 2007 15:34:49 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Man kann auch einfach boots::lexival_cast verwenden und hat keine Probleme.</p>
<p>chrische</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1231311</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1231311</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Mon, 19 Feb 2007 15:34:49 GMT</pubDate></item><item><title><![CDATA[Reply to int to string Umwandlung on Mon, 19 Feb 2007 16:05:52 GMT]]></title><description><![CDATA[<p>(D)Evil schrieb:</p>
<blockquote>
<p>Hmm kann sein das ich gerade nen Dekkel vorm Kopp hab, aber folgendes ist nicht so sinnvoll: ... denn das o in std::ostringstream steht ja eigentlich für out und man gibt nur den Integer i rein, folglich müsste es eigentlich std::istringstream heißen ... da str() kein Streamoperator ist ... sondern eine normale Funktion ... kann jetzt aber auch sein das ich müll erzähle ^^</p>
</blockquote>
<p>Das o bedeutet, das ein String ausgegeben wird, wie bei std::cout allgemein ausgegeben wird. str hat nichts mit normalen Streammethoden zu tun, sondern baut den resultierenden String zusammen und gibt ihn zurück.<br />
Du hättest natürlich auch einfach mal den Code durch deinen Compiler jagen können ... <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1231329</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1231329</guid><dc:creator><![CDATA[.filmor]]></dc:creator><pubDate>Mon, 19 Feb 2007 16:05:52 GMT</pubDate></item><item><title><![CDATA[Reply to int to string Umwandlung on Mon, 19 Feb 2007 17:33:30 GMT]]></title><description><![CDATA[<p>.filmor schrieb:</p>
<blockquote>
<p>Du hättest natürlich auch einfach mal den Code durch deinen Compiler jagen können ... <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /></p>
</blockquote>
<p>Hmm ... was soll das bringen? Der wird dazu nichts sagen ob ich lieber istringstream oder ostringstream verwende.</p>
<p>Hmm ...aber ich meinte folgendes:</p>
<pre><code class="language-cpp">#include &lt;sstream&gt;
#include &lt;string&gt;
#include &lt;iostream&gt;

int main()
{
    // std::ostringstream
    unsigned int i = 2;
    std::ostringstream ss;
    ss.str(&quot;1123123&quot;);
    ss &gt;&gt; i; // DANN ist ostringstream richtig ...
    std::cout &lt;&lt; i &lt;&lt; std::endl;

    // std::istringstream
    std::istringstream ss;
    ss &lt;&lt; i; // Hier schieben wa ja was rein ...
    std::string string(ss.str());
    std::cout &lt;&lt; string &lt;&lt; std::endl;
}
</code></pre>
<p>...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1231394</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1231394</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Mon, 19 Feb 2007 17:33:30 GMT</pubDate></item><item><title><![CDATA[Reply to int to string Umwandlung on Mon, 19 Feb 2007 17:42:13 GMT]]></title><description><![CDATA[<p>(D)Evil schrieb:</p>
<blockquote>
<p>Hmm ... was soll das bringen? Der wird dazu nichts sagen ob ich lieber istringstream oder ostringstream verwende.</p>
</blockquote>
<p>Natürlich wird er dir was sagen. Ein istringstream ist nämlich ein <em>istream</em>, während ein ostringstream ein <em>ostream</em> ist. Für ersteren ist der Operator &gt;&gt; definiert, für letzteren der Operator &lt;&lt;, was dir der Compiler auch sehr freundlich beigebracht hätte <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f609.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--winking_face"
      title=";)"
      alt="😉"
    /><br />
Nochmal zur Erinnerung: std::cin ist ein istream, std::cout ist ein ostream.</p>
<p>(D)Evil schrieb:</p>
<blockquote>
<p>Hmm ...aber ich meinte folgendes:...</p>
</blockquote>
<p>Bittschön, das sagt g++ (und er hat Recht ;)) (ich hab nur das erste ss zu os und das zweite zu is gemacht):</p>
<pre><code>test.cpp: In function 'int main()':
test.cpp:11: error: no match for 'operator&gt;&gt;' in 'os &gt;&gt; i'
test.cpp:16: error: no match for 'operator&lt;&lt;' in 'is &lt;&lt; i'
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1231400</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1231400</guid><dc:creator><![CDATA[.filmor]]></dc:creator><pubDate>Mon, 19 Feb 2007 17:42:13 GMT</pubDate></item><item><title><![CDATA[Reply to int to string Umwandlung on Mon, 19 Feb 2007 18:52:49 GMT]]></title><description><![CDATA[<p>Hmm ok hast mich überzeugt ^^</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1231454</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1231454</guid><dc:creator><![CDATA[*D*Evil]]></dc:creator><pubDate>Mon, 19 Feb 2007 18:52:49 GMT</pubDate></item></channel></rss>