<?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[[stringstream] Problem beim umwandeln]]></title><description><![CDATA[<p>Hi,</p>
<p>hab noch eine Frage zu Stringstreams. Mit dem folgenden Kode wandle ich einen String in ein Zahl um, verändere die Zahl und wandle die Zahl wieder in einen String um. Ich habe versucht, für die Umwandlung einen stringstream zu nehmen, aber wenn ich die Zahl wieder in einen String umwandlen will, dann erhalte ich entweder den alten String oder &quot;&quot; (Je nachdem ich den Stream resette oder nicht).</p>
<pre><code class="language-cpp">string tmp(&quot;536870912&quot;)

stringstream convert;
convert &lt;&lt; tmp;
int value = 0;
convert &gt;&gt; value;
//convert.str(&quot;&quot;);

value /= 0x100000;
convert &lt;&lt; value;
tmp = convert.str();

cout &lt;&lt; tmp &lt;&lt; endl;
</code></pre>
<p>Muss ich unbedingt einen ostringstream benutzen oder geht's auch irgendwie mit dem stringstream?</p>
<p>Gtüße,<br />
don_basto.</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/158154/stringstream-problem-beim-umwandeln</link><generator>RSS for Node</generator><lastBuildDate>Wed, 09 Sep 2026 15:52:18 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/158154.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 02 Sep 2006 08:17:18 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to [stringstream] Problem beim umwandeln on Sat, 02 Sep 2006 08:17:18 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>hab noch eine Frage zu Stringstreams. Mit dem folgenden Kode wandle ich einen String in ein Zahl um, verändere die Zahl und wandle die Zahl wieder in einen String um. Ich habe versucht, für die Umwandlung einen stringstream zu nehmen, aber wenn ich die Zahl wieder in einen String umwandlen will, dann erhalte ich entweder den alten String oder &quot;&quot; (Je nachdem ich den Stream resette oder nicht).</p>
<pre><code class="language-cpp">string tmp(&quot;536870912&quot;)

stringstream convert;
convert &lt;&lt; tmp;
int value = 0;
convert &gt;&gt; value;
//convert.str(&quot;&quot;);

value /= 0x100000;
convert &lt;&lt; value;
tmp = convert.str();

cout &lt;&lt; tmp &lt;&lt; endl;
</code></pre>
<p>Muss ich unbedingt einen ostringstream benutzen oder geht's auch irgendwie mit dem stringstream?</p>
<p>Gtüße,<br />
don_basto.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1129483</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1129483</guid><dc:creator><![CDATA[don_basto]]></dc:creator><pubDate>Sat, 02 Sep 2006 08:17:18 GMT</pubDate></item><item><title><![CDATA[Reply to [stringstream] Problem beim umwandeln on Sat, 02 Sep 2006 11:21:46 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>so läuft es bei mir</p>
<pre><code class="language-cpp">std::string tmp(&quot;10&quot;);
std::stringstream convert;

convert &lt;&lt; tmp;
int value = 0;
convert &gt;&gt; value;
value += 15;

convert.clear();
convert &lt;&lt; value;
convert &gt;&gt; tmp;
std::cout &lt;&lt; tmp &lt;&lt; std::endl;
</code></pre>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1129575</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1129575</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Sat, 02 Sep 2006 11:21:46 GMT</pubDate></item></channel></rss>