<?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[Backslash in Doppelbackslash umwandeln]]></title><description><![CDATA[<p>Nabend liebe Community.</p>
<p>Ich hab hier ein Char Array:</p>
<p>char AppPath[1024];<br />
GetCurrentDirectoryA(1024,AppPath);</p>
<p>Dann kommt der Pfad meiner Anwendung raus, z.B. C:\blablablabla</p>
<p>Nun möchte ich alle &quot;\&quot; duch &quot;\&quot; oder &quot;/&quot; ersetzen (Wegen der Escape Sequenzen).</p>
<p>Hat da jemand ne Idee?</p>
<p>Vielen Dank für euere Anwtworten.</p>
<p>mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/234783/backslash-in-doppelbackslash-umwandeln</link><generator>RSS for Node</generator><lastBuildDate>Thu, 24 Sep 2026 08:51:58 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/234783.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 22 Feb 2009 13:55:45 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Backslash in Doppelbackslash umwandeln on Sun, 22 Feb 2009 13:55:45 GMT]]></title><description><![CDATA[<p>Nabend liebe Community.</p>
<p>Ich hab hier ein Char Array:</p>
<p>char AppPath[1024];<br />
GetCurrentDirectoryA(1024,AppPath);</p>
<p>Dann kommt der Pfad meiner Anwendung raus, z.B. C:\blablablabla</p>
<p>Nun möchte ich alle &quot;\&quot; duch &quot;\&quot; oder &quot;/&quot; ersetzen (Wegen der Escape Sequenzen).</p>
<p>Hat da jemand ne Idee?</p>
<p>Vielen Dank für euere Anwtworten.</p>
<p>mfg</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1668062</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1668062</guid><dc:creator><![CDATA[Hanzotto234]]></dc:creator><pubDate>Sun, 22 Feb 2009 13:55:45 GMT</pubDate></item><item><title><![CDATA[Reply to Backslash in Doppelbackslash umwandeln on Sun, 22 Feb 2009 13:59:57 GMT]]></title><description><![CDATA[<p>Hmm, scheinbar macht mir das Forum auch nen Strich durch die Rechnung mit den Escape Sequenzen^^</p>
<p>Ich habs mal auf <a href="http://NoPaste.org" rel="nofollow">NoPaste.org</a> geschmissen <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>
<p><a href="http://nopaste.org/p/aIF5Quxb3" rel="nofollow">http://nopaste.org/p/aIF5Quxb3</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1668064</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1668064</guid><dc:creator><![CDATA[Hanzotto234]]></dc:creator><pubDate>Sun, 22 Feb 2009 13:59:57 GMT</pubDate></item><item><title><![CDATA[Reply to Backslash in Doppelbackslash umwandeln on Sun, 22 Feb 2009 14:13:34 GMT]]></title><description><![CDATA[<p><a href="http://www.cplusplus.com/reference/algorithm/replace.html" rel="nofollow">http://www.cplusplus.com/reference/algorithm/replace.html</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1668078</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1668078</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Sun, 22 Feb 2009 14:13:34 GMT</pubDate></item><item><title><![CDATA[Reply to Backslash in Doppelbackslash umwandeln on Sun, 22 Feb 2009 14:21:05 GMT]]></title><description><![CDATA[<p>So?</p>
<pre><code class="language-cpp">char* p = AppPath;
while ( *p )
{
	if ( *p == '\\' ) 
		*p = '/';

	++p;
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1668086</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1668086</guid><dc:creator><![CDATA[David_pb]]></dc:creator><pubDate>Sun, 22 Feb 2009 14:21:05 GMT</pubDate></item><item><title><![CDATA[Reply to Backslash in Doppelbackslash umwandeln on Sun, 22 Feb 2009 14:43:16 GMT]]></title><description><![CDATA[<p>David_pb schrieb:</p>
<blockquote>
<p>So?</p>
<pre><code class="language-cpp">char* p = AppPath;
while ( *p )
{
	if ( *p == '\\' ) 
		*p = '/';

	++p;
}
</code></pre>
</blockquote>
<p>Das funktioniert, dankeschön für die schneller Antwort.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1668102</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1668102</guid><dc:creator><![CDATA[Hanzotto234]]></dc:creator><pubDate>Sun, 22 Feb 2009 14:43:16 GMT</pubDate></item><item><title><![CDATA[Reply to Backslash in Doppelbackslash umwandeln on Sun, 22 Feb 2009 21:50:22 GMT]]></title><description><![CDATA[<p>Hanzotto234 schrieb:</p>
<blockquote>
<p>Das funktioniert, dankeschön für die schneller Antwort.</p>
</blockquote>
<p>David_pbs Vorschlag ist etwa das, was <code>std::replace()</code> macht. Aber willst du nicht <code>std::string</code> benutzen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1668405</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1668405</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Sun, 22 Feb 2009 21:50:22 GMT</pubDate></item><item><title><![CDATA[Reply to Backslash in Doppelbackslash umwandeln on Mon, 23 Feb 2009 12:52:09 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>Hanzotto234 schrieb:</p>
<blockquote>
<p>Nun möchte ich alle &quot;\&quot; duch &quot;\&quot; oder &quot;/&quot; ersetzen (Wegen der Escape Sequenzen).</p>
</blockquote>
<p>also imho braucht man das doch nicht, weil diese Darstellung von '\' im Quellttext mit '\' ist doch nur im Quelltext so. Im Speicher steht ja nicht<br />
&quot;C:\\blub.txt&quot; sonder &quot;C:\blub.txt&quot;.<br />
Die Escapesequencen sind dafür da, um nicht druckbare Zeichen, wie z.B. &quot;new line&quot; im String darzustellen. Diese werden dan in ihren entsprechenden Value umgewandelt: \n -&gt; 0x0A.</p>
<p>Gruß Pingu</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1668729</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1668729</guid><dc:creator><![CDATA[Pingu-Group]]></dc:creator><pubDate>Mon, 23 Feb 2009 12:52:09 GMT</pubDate></item><item><title><![CDATA[Reply to Backslash in Doppelbackslash umwandeln on Mon, 23 Feb 2009 13:33:19 GMT]]></title><description><![CDATA[<p>Pingu-Group schrieb:</p>
<blockquote>
<p>also imho braucht man das doch nicht, weil diese Darstellung von '\' im Quellttext mit '\' ist doch nur im Quelltext so. Im Speicher steht ja nicht<br />
&quot;C:\\blub.txt&quot; sonder &quot;C:\blub.txt&quot;.<br />
Die Escapesequencen sind dafür da, um nicht druckbare Zeichen, wie z.B. &quot;new line&quot; im String darzustellen. Diese werden dan in ihren entsprechenden Value umgewandelt: \n -&gt; 0x0A.</p>
</blockquote>
<p>Man sollte das schon ersetzen weil man sonst steuerzeichen im Pfad stehen hat und diese dann auch als solche interpretiert werden. Wenn ich dein Beispiel nehme wird eben nicht c:\blub.txt im Speicher stehen weil das \b zu einem Zeichen zusammengezogen wird (zumindest war das mal bei mir so). Deswegen würde ich zumindest die Pfadangaben immer maskieren um sicher zu sein.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1668743</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1668743</guid><dc:creator><![CDATA[Hundeman]]></dc:creator><pubDate>Mon, 23 Feb 2009 13:33:19 GMT</pubDate></item><item><title><![CDATA[Reply to Backslash in Doppelbackslash umwandeln on Mon, 23 Feb 2009 13:43:11 GMT]]></title><description><![CDATA[<p>Hundeman schrieb:</p>
<blockquote>
<p>Man sollte das schon ersetzen weil man sonst steuerzeichen im Pfad stehen hat und diese dann auch als solche interpretiert werden. Wenn ich dein Beispiel nehme wird eben nicht c:\blub.txt im Speicher stehen weil das \b zu einem Zeichen zusammengezogen wird (zumindest war das mal bei mir so).</p>
</blockquote>
<p>nein, das ist falsch.<br />
ein backslash muss <strong>nur im quellcode</strong> maskiert werden, weil der compiler escape-sequenzen interpretiert, die mit \ beginnen. zur laufzeit gibt es diese sequenzen nicht mehr. wenn der backslash mal im string steht, ist er da und wird auch nicht anders interpretiert.<br />
wenn der op also nicht gerade einen codegenerator schreibt, wäre diese ersetzung unnötig und sogar falsch. wobei das ersetzen von \ durch / für pfadangaben unter windows nicht weiter schadet.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1668745</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1668745</guid><dc:creator><![CDATA[&#x5C;&#x2F;&#x5C;&#x2F;&#x5C;&#x2F;]]></dc:creator><pubDate>Mon, 23 Feb 2009 13:43:11 GMT</pubDate></item><item><title><![CDATA[Reply to Backslash in Doppelbackslash umwandeln on Mon, 23 Feb 2009 13:55:10 GMT]]></title><description><![CDATA[<p>Ok, dann wüsste ich aber gerne warum ich beim aufruf von</p>
<p>ExtractFilePath(Application-&gt;ExeName);</p>
<p>unter dem Borland Builder anstatt des nur Pfades in dem die Exe läuft einen Pfad erhalte indem die die Pfadangabe komplett maskiert ist. Ich lasse mich da gerne korrigieren aber das Verhalten vom Compiler gibt mir an solchen Stellen das Gefühl das ich bei Strings soetwas beachten muss (wenn ich selbst nen Text eingebe mag das was völlig anderes sein).</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1668749</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1668749</guid><dc:creator><![CDATA[Hundeman]]></dc:creator><pubDate>Mon, 23 Feb 2009 13:55:10 GMT</pubDate></item><item><title><![CDATA[Reply to Backslash in Doppelbackslash umwandeln on Mon, 23 Feb 2009 14:08:41 GMT]]></title><description><![CDATA[<p>Hundeman schrieb:</p>
<blockquote>
<p>Ok, dann wüsste ich aber gerne warum ich beim aufruf von</p>
<p>ExtractFilePath(Application-&gt;ExeName);</p>
<p>unter dem Borland Builder anstatt des nur Pfades in dem die Exe läuft einen Pfad erhalte indem die die Pfadangabe komplett maskiert ist.</p>
</blockquote>
<p>das weiß ich nicht. wenn da aber sowas rauskäme wie &quot;c:\\bla\\blubb.exe&quot;, dann wäre das schon ein starkes stück und definitiv falsch.<br />
ich vermute aber, dass du dir den string im debugger angeschaut hast und der das evtl. so anzeigt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1668756</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1668756</guid><dc:creator><![CDATA[&#x2F;&#x5C;&#x2F;&#x5C;&#x2F;]]></dc:creator><pubDate>Mon, 23 Feb 2009 14:08:41 GMT</pubDate></item><item><title><![CDATA[Reply to Backslash in Doppelbackslash umwandeln on Mon, 23 Feb 2009 14:15:08 GMT]]></title><description><![CDATA[<p>/// schrieb:</p>
<blockquote>
<p>das weiß ich nicht. wenn da aber sowas rauskäme wie &quot;c:\\bla\\blubb.exe&quot;, dann wäre das schon ein starkes stück und definitiv falsch.<br />
ich vermute aber, dass du dir den string im debugger angeschaut hast und der das evtl. so anzeigt.</p>
</blockquote>
<p>Über den Debugger angezeigt schon, aber wenn ich mir dann die Speicherstellen anschaue an der der String liegt stehen auch dort die Maskierungen drin, deswegen glaube ich nicht, dass das nur ne debuggergeschichte ist. Aber vielleicht ist das auch nur ein weiteres seltsames Verhalten von der IDE.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1668763</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1668763</guid><dc:creator><![CDATA[Hundeman]]></dc:creator><pubDate>Mon, 23 Feb 2009 14:15:08 GMT</pubDate></item><item><title><![CDATA[Reply to Backslash in Doppelbackslash umwandeln on Mon, 23 Feb 2009 23:02:27 GMT]]></title><description><![CDATA[<p>Hi nochmal,</p>
<pre><code>#include &lt;iostream&gt;

int main(int argc, char** argv)
{
	char test[] = &quot;C:\\blub.txt&quot;;

	std::cout &lt;&lt; test;

	return 0;
}
</code></pre>
<p>[url=http://img147.imageshack.us/my.php?image=tetq.png]Visual C++ Debuger<br />
[/url]<br />
<a href="http://img201.imageshack.us/my.php?image=tet.png" rel="nofollow">OllyDbg</a></p>
<p>Grüßli Pingu</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1669089</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1669089</guid><dc:creator><![CDATA[Pingu-Group]]></dc:creator><pubDate>Mon, 23 Feb 2009 23:02:27 GMT</pubDate></item></channel></rss>