<?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[sscanf mit optionalen 2. Format...]]></title><description><![CDATA[<p>Also...^^</p>
<p>Folgendes habe ich vor:<br />
Ich will so was in der Art von CMD zu Übungszwecken machen...<br />
(aber mit fiktiven Befehlen^^)</p>
<p>also, ein &quot;Befehl&quot; ist zum Beispiel &quot;goto 2&quot;<br />
ein anderer ist aber zum Beispiel nur &quot;chk&quot;</p>
<p>ich hab bis jz folgendes gemacht:</p>
<pre><code class="language-cpp">printf(&quot;&gt; &quot;);
gets(input);
sscanf(input, &quot;%s %i&quot;, &amp;cmd, &amp;zahl);
</code></pre>
<p>ok... soweit so gut...^^ es funktioniert auch bei &quot;goto 2&quot;. &quot;goto&quot; wird in cmd geschrieben und der 2er in zahl...</p>
<p>ABER: wenn ich jz nur chk eingeben, ist Zahl iwas -64864586416817 was weiß ich^^ ieine sehr kleine zahl^^</p>
<p>und nun meine Frage: wie kann man da das &quot;%i&quot; optional gestalten? so dass nur das %i &quot;gesscanft&quot; wird, wenn auch eines vorhanden ist und wenns leer ist, dass es dann &quot;ignoriert&quot; wird?^^ bzw einen vorgegebenen Wert (z.B. 0) hat?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/269599/sscanf-mit-optionalen-2-format</link><generator>RSS for Node</generator><lastBuildDate>Mon, 31 Aug 2026 02:30:38 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/269599.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 28 Jun 2010 10:18:17 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to sscanf mit optionalen 2. Format... on Mon, 28 Jun 2010 10:18:17 GMT]]></title><description><![CDATA[<p>Also...^^</p>
<p>Folgendes habe ich vor:<br />
Ich will so was in der Art von CMD zu Übungszwecken machen...<br />
(aber mit fiktiven Befehlen^^)</p>
<p>also, ein &quot;Befehl&quot; ist zum Beispiel &quot;goto 2&quot;<br />
ein anderer ist aber zum Beispiel nur &quot;chk&quot;</p>
<p>ich hab bis jz folgendes gemacht:</p>
<pre><code class="language-cpp">printf(&quot;&gt; &quot;);
gets(input);
sscanf(input, &quot;%s %i&quot;, &amp;cmd, &amp;zahl);
</code></pre>
<p>ok... soweit so gut...^^ es funktioniert auch bei &quot;goto 2&quot;. &quot;goto&quot; wird in cmd geschrieben und der 2er in zahl...</p>
<p>ABER: wenn ich jz nur chk eingeben, ist Zahl iwas -64864586416817 was weiß ich^^ ieine sehr kleine zahl^^</p>
<p>und nun meine Frage: wie kann man da das &quot;%i&quot; optional gestalten? so dass nur das %i &quot;gesscanft&quot; wird, wenn auch eines vorhanden ist und wenns leer ist, dass es dann &quot;ignoriert&quot; wird?^^ bzw einen vorgegebenen Wert (z.B. 0) hat?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1918302</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1918302</guid><dc:creator><![CDATA[huberer98]]></dc:creator><pubDate>Mon, 28 Jun 2010 10:18:17 GMT</pubDate></item><item><title><![CDATA[Reply to sscanf mit optionalen 2. Format... on Mon, 28 Jun 2010 10:30:31 GMT]]></title><description><![CDATA[<p>1. C++ verwenden<br />
2. Immer nur einen Befehl (ein &quot;Wort&quot;) streamen<br />
3. Dann die jeweiligen Parameter streamen<br />
4. restliche Eingabe wegwerfen<br />
5. goto 2.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1918310</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1918310</guid><dc:creator><![CDATA[Fellhuhn]]></dc:creator><pubDate>Mon, 28 Jun 2010 10:30:31 GMT</pubDate></item><item><title><![CDATA[Reply to sscanf mit optionalen 2. Format... on Mon, 28 Jun 2010 10:34:40 GMT]]></title><description><![CDATA[<p>voll...^^</p>
<p>Danke! <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/1918312</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1918312</guid><dc:creator><![CDATA[huberer98]]></dc:creator><pubDate>Mon, 28 Jun 2010 10:34:40 GMT</pubDate></item></channel></rss>