<?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[String Wert übergeben? Kleine Frage für euch große Leute!]]></title><description><![CDATA[<p>Hallo!<br />
Kurze Frage!<br />
Ich will eigentlich einen string senden, und der soll nicht nur &quot;Hallo&quot; oder irgenwas enthalten, sondern %d!<br />
also ich hab vorher ne variable definiert und will diese variable in den string einbauen, also ungefähr so:</p>
<p>std::string str(&quot;Wert:%d&quot;,x);<br />
da kommt jedoch nur blödsinn raus!<br />
wie mach ich das?</p>
<p>so mit str=(&quot;Wert:%d,Wert2:%d&quot;,x,y).... so was halt!</p>
<p>gruß</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/238497/string-wert-übergeben-kleine-frage-für-euch-große-leute</link><generator>RSS for Node</generator><lastBuildDate>Wed, 23 Sep 2026 00:22:37 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/238497.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 11 Apr 2009 11:47:53 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to String Wert übergeben? Kleine Frage für euch große Leute! on Sat, 11 Apr 2009 11:47:53 GMT]]></title><description><![CDATA[<p>Hallo!<br />
Kurze Frage!<br />
Ich will eigentlich einen string senden, und der soll nicht nur &quot;Hallo&quot; oder irgenwas enthalten, sondern %d!<br />
also ich hab vorher ne variable definiert und will diese variable in den string einbauen, also ungefähr so:</p>
<p>std::string str(&quot;Wert:%d&quot;,x);<br />
da kommt jedoch nur blödsinn raus!<br />
wie mach ich das?</p>
<p>so mit str=(&quot;Wert:%d,Wert2:%d&quot;,x,y).... so was halt!</p>
<p>gruß</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1694396</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1694396</guid><dc:creator><![CDATA[Stringboy]]></dc:creator><pubDate>Sat, 11 Apr 2009 11:47:53 GMT</pubDate></item><item><title><![CDATA[Reply to String Wert übergeben? Kleine Frage für euch große Leute! on Sat, 11 Apr 2009 11:51:07 GMT]]></title><description><![CDATA[<p>Schlag auf <a href="http://www.cplusplus.com" rel="nofollow">www.cplusplus.com</a> den <code>std::stringstream</code> nach.</p>
<p>Die Anwendung ist ungefähr so:</p>
<pre><code class="language-cpp">double Var = 3.45;
std::stringstream Stream;
Stream &lt;&lt; &quot;Hallo &quot; &lt;&lt; Var; 

std::string Text = Stream.str();
</code></pre>
<p>Die C-Formatflags sind aufgrund mangelnder Typsicherheit nicht stark verbreitet in C++ (abgesehen von Boost.Format, wo es aber besser gelöst wurde).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1694399</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1694399</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Sat, 11 Apr 2009 11:51:07 GMT</pubDate></item><item><title><![CDATA[Reply to String Wert übergeben? Kleine Frage für euch große Leute! on Sat, 11 Apr 2009 12:44:44 GMT]]></title><description><![CDATA[<p>Hm..<br />
Geht irgendwie so nicht!</p>
<pre><code class="language-cpp">COMPort.Open(5,19200);
std::string str(&quot;hallo&quot;);
COMPort.SendData(str.c_str(), str.length()+1);
COMPort.Close();
printf(&quot;\n%d;X;%d;%d;Y;%d;%d;Z;%d;%d\n&quot;,zeichen,xx,drehx,yy,drehy,zz,drehz);
</code></pre>
<p>damit sende ich einfach nen string über COM raus!<br />
Keine große Sache!<br />
Ich will jetzt einfach das, was ich in printf habe raussenden!<br />
also ich will den Sendestring so ausschauen lassen wie das printf!<br />
wie kann ich das machen?<br />
bzw. wenn es anders als in form eines string gesendet wird, egal, hauptsache ich kanns so raussenden!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1694428</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1694428</guid><dc:creator><![CDATA[Stringboy]]></dc:creator><pubDate>Sat, 11 Apr 2009 12:44:44 GMT</pubDate></item><item><title><![CDATA[Reply to String Wert übergeben? Kleine Frage für euch große Leute! on Sat, 11 Apr 2009 13:00:19 GMT]]></title><description><![CDATA[<p>Wie gesagt. Nimm [url=http://www.boost.org/doc/libs/1_37_0/libs/format/index.html]boost::format.<br />
[/url]</p>
<p>Damit kannst du dann auch so elegant arbeiten, wie du dir es vorstellst.</p>
<p>Falls dir das zuviel Aufwand ist, kannst du sonst <a href="http://www.cplusplus.com/reference/clibrary/cstdio/sprintf/" rel="nofollow">sprintf</a> benutzen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1694431</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1694431</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Sat, 11 Apr 2009 13:00:19 GMT</pubDate></item><item><title><![CDATA[Reply to String Wert übergeben? Kleine Frage für euch große Leute! on Sat, 11 Apr 2009 14:01:43 GMT]]></title><description><![CDATA[<p>Hat geklappt!<br />
Danke!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1694458</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1694458</guid><dc:creator><![CDATA[Stringboy]]></dc:creator><pubDate>Sat, 11 Apr 2009 14:01:43 GMT</pubDate></item></channel></rss>