<?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[Sting]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich möchte aus dem Pfad Dateiname ausgeben. Ist es in c++ Möglich?</p>
<p>z.B</p>
<pre><code>string s = datei.c_str(); // ausgabe: 'c:/pfad/test.txt';
am besten möchte ich test als ausgabe haben.
</code></pre>
<p>gruß</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/255436/sting</link><generator>RSS for Node</generator><lastBuildDate>Wed, 02 Sep 2026 19:55:19 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/255436.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 30 Nov 2009 21:38:28 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Sting on Mon, 30 Nov 2009 21:38:28 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich möchte aus dem Pfad Dateiname ausgeben. Ist es in c++ Möglich?</p>
<p>z.B</p>
<pre><code>string s = datei.c_str(); // ausgabe: 'c:/pfad/test.txt';
am besten möchte ich test als ausgabe haben.
</code></pre>
<p>gruß</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1815661</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1815661</guid><dc:creator><![CDATA[miomio]]></dc:creator><pubDate>Mon, 30 Nov 2009 21:38:28 GMT</pubDate></item><item><title><![CDATA[Reply to Sting on Mon, 30 Nov 2009 21:40:54 GMT]]></title><description><![CDATA[<p>wieso hast du es nicht ausprobiert?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1815662</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1815662</guid><dc:creator><![CDATA[endless]]></dc:creator><pubDate>Mon, 30 Nov 2009 21:40:54 GMT</pubDate></item><item><title><![CDATA[Reply to Sting on Mon, 30 Nov 2009 21:46:21 GMT]]></title><description><![CDATA[<p>ich habe versucht, aber habe keine Funktion gefunden, die ähnlich funktioniert wie z. b in matlab regexprep oder strrep.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1815666</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1815666</guid><dc:creator><![CDATA[miomio]]></dc:creator><pubDate>Mon, 30 Nov 2009 21:46:21 GMT</pubDate></item><item><title><![CDATA[Reply to Sting on Mon, 30 Nov 2009 21:50:46 GMT]]></title><description><![CDATA[<p>der dateiname sollte eigentlich immer bekannt sein.</p>
<pre><code>// fstream::open
#include &lt;fstream&gt;
using namespace std;

int main () {

  fstream filestr;
  //Du öffnest die datei ja auch selbst, in dem fall halt die test.txt
  filestr.open (&quot;test.txt&quot;, fstream::in | fstream::out | fstream::app);

  // &gt;&gt; i/o operations here &lt;&lt;

  filestr.close();

  return 0;
}
</code></pre>
<p><a href="http://www.boost.org/doc/libs/1_41_0/libs/filesystem/doc/index.htm" rel="nofollow">oder du schaust hier</a> <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/1815667</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1815667</guid><dc:creator><![CDATA[endless]]></dc:creator><pubDate>Mon, 30 Nov 2009 21:50:46 GMT</pubDate></item><item><title><![CDATA[Reply to Sting on Tue, 01 Dec 2009 12:18:42 GMT]]></title><description><![CDATA[<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/19984">@endless</a>, du hast die Frage falsch verstanden!</p>
<p>Eine Standardfunktion in C++ gibt es dafür nicht (da Standard C++ noch nicht einmal Pfade und Dateien kennt -), jedoch kannst du mit den String-Funktionen den Dateinamen extrahieren, z.B.</p>
<pre><code class="language-cpp">string s = datei.c_str(); // ausgabe: 'c:/pfad/test.txt';

size_t anfang = s.rfind('/');
size_t ende = s.rfind('.');

if(anfang == string::npos)
  anfang = 0;
else
  anfang++;

if(ende == string::npos)
  ende = s.length();

string dateiname = s.substr(anfang, ende - anfang);
</code></pre>
<p>Könnten jetzt noch Index-Fehler drin sein, einfach mal ausprobieren...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1815866</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1815866</guid><dc:creator><![CDATA[Th69]]></dc:creator><pubDate>Tue, 01 Dec 2009 12:18:42 GMT</pubDate></item><item><title><![CDATA[Reply to Sting on Fri, 14 May 2010 15:09:36 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>ich versuche eine Funktionzu zu schreiben, die überprüft, ob ein Array element gleich 5 ist, index merkt und ab diesen Index Schleife weiter durchläuft. Mein Codefragment:</p>
<pre><code>double m[] = {2, 4, 5, 3, 1, 5, 2, 5, 6, 5, 10, 7};
	std::vector&lt;double&gt; m_max;
        int l = 0;
	for(int start = l; start &lt; 12; start++)
	{
	    if (m[start] == 5){
	       m_max.push_back(m[start]);
               l = start;
		break;
	    }

	}
</code></pre>
<p>z.B findet erte Zahl 5, speichert in m_max und bei der zweiten Schleifedurchlauf<br />
fängt ab index 3(nicht ab 0)an.<br />
Ich brauche hilfe, allein finde ich den Fehler nicht.</p>
<p>Danke Euch,</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1897118</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1897118</guid><dc:creator><![CDATA[gast7]]></dc:creator><pubDate>Fri, 14 May 2010 15:09:36 GMT</pubDate></item><item><title><![CDATA[Reply to Sting on Fri, 14 May 2010 15:18:02 GMT]]></title><description><![CDATA[<p>Mach für neue Probleme einen neuen Thread auf. Mit Threadnekromantie, noch dazu zu einem völlig anderen Thema, machst du dich ganz schnell ganz unbeliebt.</p>
<p>Was ist dein Fehler?</p>
<p>Unabhängig davon, dass ich nicht weiß, was du willst, hat dein Code ein paar Probleme:<br />
- In Zeile 4 gehst du bei 1 los, Arrays fangen bei 0 an.<br />
- In Zeile 6 vergleichst du double-Werte mittels ==. Ganz gefährlich, weil es oftmals nicht so funktioniert wie man denkt.<br />
- Schrecklich unpassende Variablennamen<br />
- Schrecklich unpassende Einrückung</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1897124</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1897124</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Fri, 14 May 2010 15:18:02 GMT</pubDate></item></channel></rss>