<?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-Zerlegung]]></title><description><![CDATA[<p>Hallo, ich brauch ein wenig Hilfe bei der Zerlegung von strings.</p>
<p>Ich will eine Eingabe, die folgendermaßen aussieht zerlegen!<br />
c:\verzeichnis1\verzeichnis2\tuwas.exe</p>
<p>Ich möchte folgende Ausgaben haben:<br />
Festplatte : c:<br />
Verzeichnis1 : verzeichnis1<br />
Verzeichnis2 : verzeichnis2</p>
<p>------- soll solange laufen bis kein unterverzeichnis mehr vorhanden-------</p>
<p>Verzeichnis n : verzeichnis n<br />
Datei : tuwas.exe</p>
<p>Habe schon mal so angefangen:</p>
<p>void eingabe(char* Text)<br />
{<br />
int i = 0;<br />
int a = 0;<br />
cout &lt;&lt; &quot;Bitte geben Sie ein Verzeichnis an: &quot; &lt;&lt; endl;<br />
cin &gt;&gt; Text;<br />
std::string verzeichnis(Text);<br />
for (i=0;i&lt;=verzeichnis.find(&quot;:&quot;);i++)<br />
{<br />
Text[i];<br />
}<br />
}</p>
<p>Leider weiss ich jetzt nicht mehr weiter.<br />
Kann mir jemand helfen?<br />
THX asterix</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/233955/string-zerlegung</link><generator>RSS for Node</generator><lastBuildDate>Thu, 24 Sep 2026 14:24:06 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/233955.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 11 Feb 2009 11:49:50 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to String-Zerlegung on Wed, 11 Feb 2009 11:50:30 GMT]]></title><description><![CDATA[<p>Hallo, ich brauch ein wenig Hilfe bei der Zerlegung von strings.</p>
<p>Ich will eine Eingabe, die folgendermaßen aussieht zerlegen!<br />
c:\verzeichnis1\verzeichnis2\tuwas.exe</p>
<p>Ich möchte folgende Ausgaben haben:<br />
Festplatte : c:<br />
Verzeichnis1 : verzeichnis1<br />
Verzeichnis2 : verzeichnis2</p>
<p>------- soll solange laufen bis kein unterverzeichnis mehr vorhanden-------</p>
<p>Verzeichnis n : verzeichnis n<br />
Datei : tuwas.exe</p>
<p>Habe schon mal so angefangen:</p>
<p>void eingabe(char* Text)<br />
{<br />
int i = 0;<br />
int a = 0;<br />
cout &lt;&lt; &quot;Bitte geben Sie ein Verzeichnis an: &quot; &lt;&lt; endl;<br />
cin &gt;&gt; Text;<br />
std::string verzeichnis(Text);<br />
for (i=0;i&lt;=verzeichnis.find(&quot;:&quot;);i++)<br />
{<br />
Text[i];<br />
}<br />
}</p>
<p>Leider weiss ich jetzt nicht mehr weiter.<br />
Kann mir jemand helfen?<br />
THX asterix</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1661648</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1661648</guid><dc:creator><![CDATA[Asterix76]]></dc:creator><pubDate>Wed, 11 Feb 2009 11:50:30 GMT</pubDate></item><item><title><![CDATA[Reply to String-Zerlegung on Wed, 11 Feb 2009 12:05:05 GMT]]></title><description><![CDATA[<p>Guck dir mal getline an. Als Trennzeichen verwendest du '\' und kannst somit die Daten einfach nacheinander auslesen.</p>
<p>Getline: <a href="http://www.cplusplus.com/reference/string/getline.html" rel="nofollow">http://www.cplusplus.com/reference/string/getline.html</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1661666</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1661666</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Wed, 11 Feb 2009 12:05:05 GMT</pubDate></item><item><title><![CDATA[Reply to String-Zerlegung on Wed, 11 Feb 2009 12:11:41 GMT]]></title><description><![CDATA[<p>THX vorerst <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f642.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--slightly_smiling_face"
      title=":-)"
      alt="🙂"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1661672</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1661672</guid><dc:creator><![CDATA[Asterix76]]></dc:creator><pubDate>Wed, 11 Feb 2009 12:11:41 GMT</pubDate></item><item><title><![CDATA[Reply to String-Zerlegung on Wed, 11 Feb 2009 12:39:40 GMT]]></title><description><![CDATA[<p>Hallo, vielleicht kannst du mir nochmal helfen?<br />
Ich bekomme das irgendwie nicht hin:</p>
<pre><code>void eingabe(char* Text)
{
     string platte;
     string pfad;
     char doppelpunkt = ':';
     char verzeichnis = '\\';

     cout &lt;&lt; &quot;Geben sie ein Verzeichnis an: &quot;;
     getline (cin,platte,doppelpunkt);
     getline (cin,pfad,verzeichnis);
     cout &lt;&lt; &quot;Platte: &quot; &lt;&lt; platte  &lt;&lt; doppelpunkt &lt;&lt; endl;
     cout &lt;&lt; &quot;Verzeichnis: &quot; &lt;&lt; verzeichnis  &lt;&lt; pfad &lt;&lt; endl;

}
</code></pre>
<p>Wie bekomme ich das hin, dass er alle verzeichnis aulfistet?<br />
Thx im voraus, asterix</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1661691</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1661691</guid><dc:creator><![CDATA[Asterix76]]></dc:creator><pubDate>Wed, 11 Feb 2009 12:39:40 GMT</pubDate></item><item><title><![CDATA[Reply to String-Zerlegung on Wed, 11 Feb 2009 13:06:27 GMT]]></title><description><![CDATA[<p>Ich hab's jetzt nicht ausprobiert, aber es müsste gehen, indem du so lange verzeichnisnamen einliest, bis dir getline nichts mehr zurückliefert. Der letzte gelieferte Wert ist dann der Dateiname, alles davor Verzeichnisnamen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1661724</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1661724</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Wed, 11 Feb 2009 13:06:27 GMT</pubDate></item><item><title><![CDATA[Reply to String-Zerlegung on Wed, 11 Feb 2009 14:43:08 GMT]]></title><description><![CDATA[<p>Hi, ich bekomme das einfach nicht hin. Ich verzweifel gerade.<br />
Hast Du evtl. noch einen Hinweis für mich.<br />
Ich weiss nicht, wie ich alle Pfadangaben nacheinander einlesen soll.</p>
<p>Thx asterix</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1661827</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1661827</guid><dc:creator><![CDATA[Asterix76]]></dc:creator><pubDate>Wed, 11 Feb 2009 14:43:08 GMT</pubDate></item><item><title><![CDATA[Reply to String-Zerlegung on Wed, 11 Feb 2009 18:21:29 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">std::string path = &quot;c:\\verzeichnis1\\verzeichnis2\\tuwas.exe&quot;;
std::vector&lt;std::string&gt; elements;
std::stringstream s; 
s &lt;&lt; path;

std::string temp = &quot;&quot;;

std::getline(s,temp,':');
elements.push_back(temp);	
s.ignore(1);

while (std::getline (s,temp,'\\') )
	elements.push_back(temp);
</code></pre>
<p>Musst einfach schauen, dass der Pfad zwei Backslashs hat.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1662004</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1662004</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Wed, 11 Feb 2009 18:21:29 GMT</pubDate></item></channel></rss>