<?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[arbeiten mit string]]></title><description><![CDATA[<p>hallo,</p>
<p>ich wollte eine neue Verzeichnis erstellen und mit zwei strings verketten. Mein Programm funktioniert, aber es scheint mir sehr ungeschikt. Wäre eine elegantere Lösung möglich?</p>
<p>Hier mein Codefragment.</p>
<pre><code>// neues Verzeichnis erstellen
		string str = filename; // Q://g/
		const char c = _mkdir(&quot;Q://neueOrdner&quot;);

		int k = 5 ; 
		// intiger nach string
		ostringstream outStream; 
		outStream &lt;&lt; k;
		string s = outStream.str();

		// pfad für ausgabe
		string p = &quot;Q://neueOrdner/&quot;;
		string pfad  = p + s + str.erase(0,6);

		ofstream out(pfad.c_str());
....
</code></pre>
<p>ich danke Euch für euren Vorschlag!<br />
ns</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/262745/arbeiten-mit-string</link><generator>RSS for Node</generator><lastBuildDate>Sun, 06 Sep 2026 09:26:03 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/262745.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 10 Mar 2010 18:18:50 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to arbeiten mit string on Wed, 10 Mar 2010 18:18:50 GMT]]></title><description><![CDATA[<p>hallo,</p>
<p>ich wollte eine neue Verzeichnis erstellen und mit zwei strings verketten. Mein Programm funktioniert, aber es scheint mir sehr ungeschikt. Wäre eine elegantere Lösung möglich?</p>
<p>Hier mein Codefragment.</p>
<pre><code>// neues Verzeichnis erstellen
		string str = filename; // Q://g/
		const char c = _mkdir(&quot;Q://neueOrdner&quot;);

		int k = 5 ; 
		// intiger nach string
		ostringstream outStream; 
		outStream &lt;&lt; k;
		string s = outStream.str();

		// pfad für ausgabe
		string p = &quot;Q://neueOrdner/&quot;;
		string pfad  = p + s + str.erase(0,6);

		ofstream out(pfad.c_str());
....
</code></pre>
<p>ich danke Euch für euren Vorschlag!<br />
ns</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1867137</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1867137</guid><dc:creator><![CDATA[ns]]></dc:creator><pubDate>Wed, 10 Mar 2010 18:18:50 GMT</pubDate></item><item><title><![CDATA[Reply to arbeiten mit string on Wed, 10 Mar 2010 18:39:39 GMT]]></title><description><![CDATA[<p>ns schrieb:</p>
<blockquote>
<p>hallo,</p>
<p>ich wollte eine neue Verzeichnis erstellen und mit zwei strings verketten. Mein Programm funktioniert, aber es scheint mir sehr ungeschikt. Wäre eine elegantere Lösung möglich?</p>
<p>Hier mein Codefragment.</p>
<pre><code>// neues Verzeichnis erstellen
		string str = filename; // Q://g/
		const char c = _mkdir(&quot;Q://neueOrdner&quot;);

		int k = 5 ; 
		// intiger nach string
		ostringstream outStream; 
		outStream &lt;&lt; k;
		string s = outStream.str();

		// pfad für ausgabe
		string p = &quot;Q://neueOrdner/&quot;;
		string pfad  = p + s + str.erase(0,6);

		ofstream out(pfad.c_str());
....
</code></pre>
<p>ich danke Euch für euren Vorschlag!<br />
ns</p>
</blockquote>
<p>Vielleicht so? Verstehe den Sinn auch nicht komplett...</p>
<p>[/cpp]<br />
_mkdir(&quot;Q://neueOrdner&quot;);</p>
<p>ostringstream outStream;</p>
<p>outStream &lt;&lt; p &lt;&lt; k &lt;&lt; filename.erase(0,6);</p>
<p>ofstream out(outStream.str().c_str());<br />
[cpp]</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1867148</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1867148</guid><dc:creator><![CDATA[jksdfsd]]></dc:creator><pubDate>Wed, 10 Mar 2010 18:39:39 GMT</pubDate></item></channel></rss>