<?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: Format übertragen]]></title><description><![CDATA[<p>Hallo Community,</p>
<p>ich habe gestern nach einer C++-Alternative für &quot;sscanf&quot; gesucht und bin bei Stringstreams hängen geblieben.</p>
<p>Mein Problem:</p>
<p>Ich habe einen String vom Format &quot;String Zahl Zahl Zahl&quot;.<br />
Nun möchte ich die drei Zahlen übertragen und den anfänglichen String einfach ignorieren.</p>
<p>Mein bisheriger Ansatz sieht wie folgt aus:</p>
<pre><code>stringstream hLine(&quot;asdf 1 2 3&quot;);

int a = 0;
int b = 0;
int c = 0;

hLine &gt;&gt; a &gt;&gt; b &gt;&gt; c;
</code></pre>
<p>Jedoch klappt das nur wenn der anfänglich Text nicht dort ist.</p>
<p>Meine Frage:<br />
Wie kann ich den anfänglichen Teil ignorieren?</p>
<p>Ich hoffe mal ich habe keinen blöden Denkfehler oder habe einen anderen Artikel zu dem Thema übersehen.</p>
<p>Mit freundlichen Grüßen,</p>
<p>Atgoogat</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/339315/stringstream-format-übertragen</link><generator>RSS for Node</generator><lastBuildDate>Sun, 12 Apr 2026 05:56:48 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/339315.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 20 Aug 2016 10:49:02 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to StringStream: Format übertragen on Sat, 20 Aug 2016 10:49:02 GMT]]></title><description><![CDATA[<p>Hallo Community,</p>
<p>ich habe gestern nach einer C++-Alternative für &quot;sscanf&quot; gesucht und bin bei Stringstreams hängen geblieben.</p>
<p>Mein Problem:</p>
<p>Ich habe einen String vom Format &quot;String Zahl Zahl Zahl&quot;.<br />
Nun möchte ich die drei Zahlen übertragen und den anfänglichen String einfach ignorieren.</p>
<p>Mein bisheriger Ansatz sieht wie folgt aus:</p>
<pre><code>stringstream hLine(&quot;asdf 1 2 3&quot;);

int a = 0;
int b = 0;
int c = 0;

hLine &gt;&gt; a &gt;&gt; b &gt;&gt; c;
</code></pre>
<p>Jedoch klappt das nur wenn der anfänglich Text nicht dort ist.</p>
<p>Meine Frage:<br />
Wie kann ich den anfänglichen Teil ignorieren?</p>
<p>Ich hoffe mal ich habe keinen blöden Denkfehler oder habe einen anderen Artikel zu dem Thema übersehen.</p>
<p>Mit freundlichen Grüßen,</p>
<p>Atgoogat</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2506021</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2506021</guid><dc:creator><![CDATA[Atgoogat]]></dc:creator><pubDate>Sat, 20 Aug 2016 10:49:02 GMT</pubDate></item><item><title><![CDATA[Reply to StringStream: Format übertragen on Sat, 20 Aug 2016 10:55:34 GMT]]></title><description><![CDATA[<p>Atgoogat schrieb:</p>
<blockquote>
<p>Hallo Community,</p>
<p>ich habe gestern nach einer C++-Alternative für &quot;sscanf&quot; gesucht und bin bei Stringstreams hängen geblieben.</p>
<pre><code>stringstream hLine(&quot;asdf 1 2 3&quot;);

string dummy;

int a = 0;
int b = 0;
int c = 0;

hLine &gt;&gt; dummy &gt;&gt; a &gt;&gt; b &gt;&gt; c;
</code></pre>
<p>t</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/2506023</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2506023</guid><dc:creator><![CDATA[Belli]]></dc:creator><pubDate>Sat, 20 Aug 2016 10:55:34 GMT</pubDate></item><item><title><![CDATA[Reply to StringStream: Format übertragen on Sat, 20 Aug 2016 11:35:14 GMT]]></title><description><![CDATA[<p>Welches Format hat String? Wenn es keinen Leerraum beinhaltet:</p>
<pre><code>while (hLine &amp;&amp; not std::isspace((unsigned char)hLine.get()));
</code></pre>
<p>Edit: War wohl doch ein wenig komplizierter als gedacht... <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f603.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--grinning_face_with_big_eyes"
      title=":D"
      alt="😃"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/2506026</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2506026</guid><dc:creator><![CDATA[Columbo]]></dc:creator><pubDate>Sat, 20 Aug 2016 11:35:14 GMT</pubDate></item><item><title><![CDATA[Reply to StringStream: Format übertragen on Sat, 20 Aug 2016 15:48:12 GMT]]></title><description><![CDATA[<p>Danke für die schnellen Antworten!</p>
<p>Belli: Deine Möglichkeit funktioniert aber irgendwie wirkt das ein wenig wie nicht so geplannt. Gibt es dafür keine Platzhalter oder ähnliches? Trotzdem danke sehr!</p>
<p>Arcoth: 'String' hat keinen Leerraum also wäre das eine Option jedoch würde ich dann eher mit der Lösung von Belli fahren da diese einfach zu Händeln ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2506057</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2506057</guid><dc:creator><![CDATA[Atgoogat]]></dc:creator><pubDate>Sat, 20 Aug 2016 15:48:12 GMT</pubDate></item><item><title><![CDATA[Reply to StringStream: Format übertragen on Sun, 21 Aug 2016 14:32:37 GMT]]></title><description><![CDATA[<p>Hallo Atgoogat,<br />
falls sicher ist, dass es sich bei dem Zeichen vor der Zahl um ein Leerzeichen handelt, kann man auch alles bis dorthin überlesen:</p>
<pre><code>#include &lt;iostream&gt;
#include &lt;sstream&gt;

int main()
{
    using namespace std;
    stringstream hLine(&quot;asdf 1 2 3&quot;);
    int a, b, c;
    if( hLine.ignore( 9999, ' ' ) &gt;&gt; a &gt;&gt; b &gt;&gt; c )
        cout &lt;&lt; &quot;Gelesen: a=&quot; &lt;&lt; a &lt;&lt; &quot; b=&quot; &lt;&lt; b &lt;&lt; &quot; c=&quot; &lt;&lt; c &lt;&lt; endl;
}
</code></pre>
<p>Gruß<br />
Werner</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2506123</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2506123</guid><dc:creator><![CDATA[Werner Salomon]]></dc:creator><pubDate>Sun, 21 Aug 2016 14:32:37 GMT</pubDate></item><item><title><![CDATA[Reply to StringStream: Format übertragen on Tue, 23 Aug 2016 10:47:50 GMT]]></title><description><![CDATA[<p>Klasse!</p>
<p>Ja es ist immer ein Leerzeichen dort also werde ich jetzt diese Lösung verwenden.</p>
<p>Vielen Dank für alle Antworten!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/2506302</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/2506302</guid><dc:creator><![CDATA[Atgoogat]]></dc:creator><pubDate>Tue, 23 Aug 2016 10:47:50 GMT</pubDate></item></channel></rss>