<?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[Fortlaufende Verzeichniserstellung mit system-Befehl unter Linux]]></title><description><![CDATA[<p>Hallo</p>
<p>Bin ein absoluter Anfänger in Sachen C++ und will aber folgendes Problem lösen und komm nicht weiter.</p>
<p>Ich arbeite an einem Linux rechner und will über den Befehl system(&quot;...&quot;) Befehle direkt ausführen auf der Konsole.<br />
An sich funktionierts ganz gut, aber jetzt würd ich gern neue Verzeichniss erstellen die fortlaufend nummeriert sind. Dazu will ich das ganze in eine for-Schleife packen</p>
<p>double i;</p>
<p>for(int k=0;k&lt;10;k++){<br />
i = system(&quot;mkdir /Test....&quot;)</p>
<p>}</p>
<p>und jetzt sollte halt durch die Laufvariable k fortlaufend Test1,Test2, usw entstehn.</p>
<p>Wie kann ich das bewerkstelligen?</p>
<p>Danke schon mal!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/206089/fortlaufende-verzeichniserstellung-mit-system-befehl-unter-linux</link><generator>RSS for Node</generator><lastBuildDate>Sat, 10 Oct 2026 05:05:26 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/206089.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 21 Feb 2008 08:35:17 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Fortlaufende Verzeichniserstellung mit system-Befehl unter Linux on Thu, 21 Feb 2008 08:35:17 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Bin ein absoluter Anfänger in Sachen C++ und will aber folgendes Problem lösen und komm nicht weiter.</p>
<p>Ich arbeite an einem Linux rechner und will über den Befehl system(&quot;...&quot;) Befehle direkt ausführen auf der Konsole.<br />
An sich funktionierts ganz gut, aber jetzt würd ich gern neue Verzeichniss erstellen die fortlaufend nummeriert sind. Dazu will ich das ganze in eine for-Schleife packen</p>
<p>double i;</p>
<p>for(int k=0;k&lt;10;k++){<br />
i = system(&quot;mkdir /Test....&quot;)</p>
<p>}</p>
<p>und jetzt sollte halt durch die Laufvariable k fortlaufend Test1,Test2, usw entstehn.</p>
<p>Wie kann ich das bewerkstelligen?</p>
<p>Danke schon mal!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1459953</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1459953</guid><dc:creator><![CDATA[Azador]]></dc:creator><pubDate>Thu, 21 Feb 2008 08:35:17 GMT</pubDate></item><item><title><![CDATA[Reply to Fortlaufende Verzeichniserstellung mit system-Befehl unter Linux on Thu, 21 Feb 2008 09:02:59 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#include &lt;string&gt;
#include &lt;sstream&gt;
// ...
std::string command(&quot;mkdir /tmp/Test&quot;);
std::istringstream stream;

for(...){
  stream.str(command);
  stream &lt;&lt; k;
  system(stream.str());
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1459971</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1459971</guid><dc:creator><![CDATA[Fellhuhn]]></dc:creator><pubDate>Thu, 21 Feb 2008 09:02:59 GMT</pubDate></item><item><title><![CDATA[Reply to Fortlaufende Verzeichniserstellung mit system-Befehl unter Linux on Thu, 21 Feb 2008 09:13:46 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>danke für die schnelle Antwort,aber bei mir funktioniert der Code leider nicht<br />
Ich bekomme als Fehlermeldung</p>
<p>error: no match for 'operator&lt;&lt;' in 'stream &lt;&lt; k'<br />
error: cannot convert `std::basic_string&lt;char</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1459982</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1459982</guid><dc:creator><![CDATA[Azador]]></dc:creator><pubDate>Thu, 21 Feb 2008 09:13:46 GMT</pubDate></item><item><title><![CDATA[Reply to Fortlaufende Verzeichniserstellung mit system-Befehl unter Linux on Thu, 21 Feb 2008 09:25:46 GMT]]></title><description><![CDATA[<p>Sorry, Flüchtigkeitsfehler. Mach aus istringstream nur stringstream.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1459994</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1459994</guid><dc:creator><![CDATA[Fellhuhn]]></dc:creator><pubDate>Thu, 21 Feb 2008 09:25:46 GMT</pubDate></item><item><title><![CDATA[Reply to Fortlaufende Verzeichniserstellung mit system-Befehl unter Linux on Thu, 21 Feb 2008 09:33:39 GMT]]></title><description><![CDATA[<p>Sorry wenn ich dich damit jetzt nerve, aber ich krieg daraufhin folgende Fehlermeldung..(Ich bemüh mich zwar selber rauszufinden was das heißt und wie ich es beheben kann, aber ich denk das Forum ist einfach schneller)</p>
<p>error: cannot convert <code>std::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt; &gt;' to</code>const char*' for<br />
argument `1' to `int system(const char*)'</p>
<p>in der for schleife deklariere ich k als int also wie im ersten Beitrag geschrieben. Liegt das der Fehler?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1459996</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1459996</guid><dc:creator><![CDATA[Azador]]></dc:creator><pubDate>Thu, 21 Feb 2008 09:33:39 GMT</pubDate></item><item><title><![CDATA[Reply to Fortlaufende Verzeichniserstellung mit system-Befehl unter Linux on Thu, 21 Feb 2008 09:34:46 GMT]]></title><description><![CDATA[<p>Der Fehler ist, dass str() einen String zurückgibt, aber System einen const char* erwartet - glücklicherweise hat String eine Methode, die einen const char* zurückgibt:</p>
<pre><code class="language-cpp">system(stream.str().c_str());
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1459998</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1459998</guid><dc:creator><![CDATA[LordJaxom]]></dc:creator><pubDate>Thu, 21 Feb 2008 09:34:46 GMT</pubDate></item><item><title><![CDATA[Reply to Fortlaufende Verzeichniserstellung mit system-Befehl unter Linux on Thu, 21 Feb 2008 09:39:25 GMT]]></title><description><![CDATA[<p>Ah, noch ein Flüchtigkeitsfehler. Hab das eben nur mit cout getestet, wollte mir nicht die Festplatte zumüllen. <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/1460003</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1460003</guid><dc:creator><![CDATA[Fellhuhn]]></dc:creator><pubDate>Thu, 21 Feb 2008 09:39:25 GMT</pubDate></item><item><title><![CDATA[Reply to Fortlaufende Verzeichniserstellung mit system-Befehl unter Linux on Thu, 21 Feb 2008 09:42:37 GMT]]></title><description><![CDATA[<p>Puhhh. Danke.<br />
Aber ich hoffe das ist jetzt die letzte Frage. Er setzt mir die Variable k jetzt immer an den Anfang von dem string. Ich bekomm &quot;0kdir ....&quot; statt &quot;mkdir&quot;.</p>
<p>Ich sehe, ich muss noch viel lernen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1460006</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1460006</guid><dc:creator><![CDATA[Azador]]></dc:creator><pubDate>Thu, 21 Feb 2008 09:42:37 GMT</pubDate></item><item><title><![CDATA[Reply to Fortlaufende Verzeichniserstellung mit system-Befehl unter Linux on Thu, 21 Feb 2008 09:45:09 GMT]]></title><description><![CDATA[<p>edit</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1460007</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1460007</guid><dc:creator><![CDATA[Azador]]></dc:creator><pubDate>Thu, 21 Feb 2008 09:45:09 GMT</pubDate></item><item><title><![CDATA[Reply to Fortlaufende Verzeichniserstellung mit system-Befehl unter Linux on Thu, 21 Feb 2008 10:03:11 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">#include &lt;string&gt;
#include &lt;sstream&gt;
#include &lt;iostream&gt;

int main( ) {

	std::string command( &quot;mkdir /tmp/Test&quot; );
	std::stringstream stream;

	for( int k = 0; k &lt; 10; ++k ) {

		stream.str( command ); // lässt die Leseposition unverändert...
		stream.seekp( 0, std::ios_base::end ); // ...deshalb manuell an's Ende setzen.

		stream &lt;&lt; k;

		std::cout &lt;&lt; stream.str( ) &lt;&lt; std::endl;
	}
}
</code></pre>
<p>greetz, Swordfish</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1460022</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1460022</guid><dc:creator><![CDATA[Swordfish]]></dc:creator><pubDate>Thu, 21 Feb 2008 10:03:11 GMT</pubDate></item><item><title><![CDATA[Reply to Fortlaufende Verzeichniserstellung mit system-Befehl unter Linux on Thu, 21 Feb 2008 10:08:17 GMT]]></title><description><![CDATA[<p>Ausgezeichnet!!!!!</p>
<p>Danke</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1460028</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1460028</guid><dc:creator><![CDATA[Azador]]></dc:creator><pubDate>Thu, 21 Feb 2008 10:08:17 GMT</pubDate></item><item><title><![CDATA[Reply to Fortlaufende Verzeichniserstellung mit system-Befehl unter Linux on Thu, 21 Feb 2008 15:04:20 GMT]]></title><description><![CDATA[<p>EDIT, mein Fehler</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1460275</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1460275</guid><dc:creator><![CDATA[Azador]]></dc:creator><pubDate>Thu, 21 Feb 2008 15:04:20 GMT</pubDate></item></channel></rss>