<?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[remove() aus der Kommandozeile(*argv[])]]></title><description><![CDATA[<p>Servus,</p>
<p>hab Windows XP und schreib mit Notpad++ und will eine Datei aus der Kommandozeile löschen.<br />
Hab mir sehr viele Foren Themen angesehen und gegoogelt aber bisher klappt es leider noch nicht.<br />
Lese aus der Kommandozeile mit char *argv[].<br />
argv hab ich schon mit argv ++ weitergeschaltet. Es würde also auf die richtige Datei zeigen. Bin mir sicher da ich vorher damit auch schon etwas damit anstelle.</p>
<p>[code]<br />
if( remove (*argv) == 0 )<br />
{<br />
cerr &lt;&lt;endl&lt;&lt;&quot;deleted&quot;&lt;&lt;endl;<br />
exit(-1);<br />
}<br />
else<br />
cerr &lt;&lt;endl&lt;&lt;&quot;not deleted&quot;&lt;&lt;endl;<br />
[\code]</p>
<p>Leider kommt keine Fehlermeldung vom Compiler.<br />
Die Datei wird so nicht gelöscht.<br />
bekomme -1 als Rückgabewert zurück.<br />
*argv deshalb weil ich *argv[] in die Funktion übergebe</p>
<p>Kann mir jemand weiterhelfen ??</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/213803/remove-aus-der-kommandozeile-argv</link><generator>RSS for Node</generator><lastBuildDate>Tue, 13 Oct 2026 21:53:30 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/213803.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 22 May 2008 11:05:05 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to remove() aus der Kommandozeile(*argv[]) on Thu, 22 May 2008 11:05:05 GMT]]></title><description><![CDATA[<p>Servus,</p>
<p>hab Windows XP und schreib mit Notpad++ und will eine Datei aus der Kommandozeile löschen.<br />
Hab mir sehr viele Foren Themen angesehen und gegoogelt aber bisher klappt es leider noch nicht.<br />
Lese aus der Kommandozeile mit char *argv[].<br />
argv hab ich schon mit argv ++ weitergeschaltet. Es würde also auf die richtige Datei zeigen. Bin mir sicher da ich vorher damit auch schon etwas damit anstelle.</p>
<p>[code]<br />
if( remove (*argv) == 0 )<br />
{<br />
cerr &lt;&lt;endl&lt;&lt;&quot;deleted&quot;&lt;&lt;endl;<br />
exit(-1);<br />
}<br />
else<br />
cerr &lt;&lt;endl&lt;&lt;&quot;not deleted&quot;&lt;&lt;endl;<br />
[\code]</p>
<p>Leider kommt keine Fehlermeldung vom Compiler.<br />
Die Datei wird so nicht gelöscht.<br />
bekomme -1 als Rückgabewert zurück.<br />
*argv deshalb weil ich *argv[] in die Funktion übergebe</p>
<p>Kann mir jemand weiterhelfen ??</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1514182</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1514182</guid><dc:creator><![CDATA[sepplein]]></dc:creator><pubDate>Thu, 22 May 2008 11:05:05 GMT</pubDate></item><item><title><![CDATA[Reply to remove() aus der Kommandozeile(*argv[]) on Thu, 22 May 2008 11:10:22 GMT]]></title><description><![CDATA[<pre><code>del &lt;dateiname&gt;
</code></pre>
<p><img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f921.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--clown_face"
      title=":clown:"
      alt="🤡"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1514187</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1514187</guid><dc:creator><![CDATA[Tachyon]]></dc:creator><pubDate>Thu, 22 May 2008 11:10:22 GMT</pubDate></item><item><title><![CDATA[Reply to remove() aus der Kommandozeile(*argv[]) on Thu, 22 May 2008 11:20:26 GMT]]></title><description><![CDATA[<p>Danke für die Aufmerksamkeit Tachylon.<br />
Du meinst das ich den &quot;del&quot; Befehl in die Konsole eingeben soll zum löschen.<br />
Den &quot;del&quot; Befehl in C++ gibt es nicht. nicht in <a href="http://cppreference.com" rel="nofollow">cppreference.com</a> ( habs zumindest nicht gefunden)</p>
<p>Meine Absicht ist schon das ganze in einer cpp Datei ausführen zu lassen.</p>
<p>Grund: wenn ich meine Ausgabe Datei erstelle und es wäre keine .txt Datei sondern z.B. .tx dann erstellt er mir ja z.B. ausgabe.tx<br />
Um dies zu vermeiden will ich diese Datei sofort wieder löschen damit es kein Chaos wird.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1514200</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1514200</guid><dc:creator><![CDATA[sepplein]]></dc:creator><pubDate>Thu, 22 May 2008 11:20:26 GMT</pubDate></item><item><title><![CDATA[Reply to remove() aus der Kommandozeile(*argv[]) on Thu, 22 May 2008 11:22:28 GMT]]></title><description><![CDATA[<p>sepplein schrieb:</p>
<blockquote>
<p>Meine Absicht ist schon das ganze in einer cpp Datei ausführen zu lassen.</p>
<p>Grund: wenn ich meine Ausgabe Datei erstelle und es wäre keine .txt Datei sondern z.B. .tx dann erstellt er mir ja z.B. ausgabe.tx<br />
Um dies zu vermeiden will ich diese Datei sofort wieder löschen damit es kein Chaos wird.</p>
</blockquote>
<p>Erstell die Datei doch erst garnicht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1514201</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1514201</guid><dc:creator><![CDATA[hö?]]></dc:creator><pubDate>Thu, 22 May 2008 11:22:28 GMT</pubDate></item><item><title><![CDATA[Reply to remove() aus der Kommandozeile(*argv[]) on Thu, 22 May 2008 11:24:29 GMT]]></title><description><![CDATA[<p>sepplein schrieb:</p>
<blockquote>
<p>Danke für die Aufmerksamkeit Tachylon.<br />
Du meinst das ich den &quot;del&quot; Befehl in die Konsole eingeben soll zum löschen.<br />
Den &quot;del&quot; Befehl in C++ gibt es nicht. nicht in <a href="http://cppreference.com" rel="nofollow">cppreference.com</a> ( habs zumindest nicht gefunden)</p>
<p>Meine Absicht ist schon das ganze in einer cpp Datei ausführen zu lassen.</p>
<p>Grund: wenn ich meine Ausgabe Datei erstelle und es wäre keine .txt Datei sondern z.B. .tx dann erstellt er mir ja z.B. ausgabe.tx<br />
Um dies zu vermeiden will ich diese Datei sofort wieder löschen damit es kein Chaos wird.</p>
</blockquote>
<p>Dann schau,dass du immer .txt hast.. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
<p>Ansonsten schau dir mal OS spezifische API's an. (z.B WinAPI). Ansonsten gibt es auch noch Boost Filesystem, als unabhängige Variante.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1514205</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1514205</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Thu, 22 May 2008 11:24:29 GMT</pubDate></item><item><title><![CDATA[Reply to remove() aus der Kommandozeile(*argv[]) on Thu, 22 May 2008 12:21:40 GMT]]></title><description><![CDATA[<p>Jetzt hab ichs!!!</p>
<p>@hö? Hatte Logikfehler</p>
<p>Der Programmabblauf sieht so aus.<br />
( Schemamäßig zur besseren verständlichkeit )</p>
<p>Funktion controlle der ganzen Eingaben über der Kommandozeile()<br />
{<br />
......<br />
ofstream target_file ( *++argv ); //hier wird ofstream Deklariert<br />
Funktion kontrolle ob .txt Datei ( argv ); // Kontrolle ob txt Datei<br />
file_copy_in_Ausgabe ( target_file , source_file ) // von readfile in writefile<br />
}</p>
<p>Die Ausgabe Datei wird ja schon von ofstream erstellt.<br />
Da ich danach erst in<br />
Funktion kontrolle ob .txt Datei<br />
überprüfe ob es eine txt datei handelt hat er ja schon die falsche Datei erstellt.</p>
<p>so is es richtig</p>
<p>Funktion controlle der ganzen Eingaben über der Kommandozeile()<br />
{<br />
......<br />
Funktion kontrolle ob .txt Datei ( ++argv ); // Kontrolle ob txt Datei<br />
ofstream target_file ( *argv ); //hier wird ofstream Deklariert<br />
file_copy_in_Ausgabe ( target_file , source_file ) // von readfile in writefile<br />
}</p>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/18422">@drakon</a></p>
<p>Normal versuch ich auch keine falsche Eingabe zu machen.<br />
Das Programm sollte aber so sicher wie möglich sein.</p>
<p>Danke für die Info er library &quot;Boost Filesystem&quot;. Ich denk des is ganz hilfreich auf den ersten Blick.</p>
<p>Danke an alle!!!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1514253</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1514253</guid><dc:creator><![CDATA[sepplein]]></dc:creator><pubDate>Thu, 22 May 2008 12:21:40 GMT</pubDate></item><item><title><![CDATA[Reply to remove() aus der Kommandozeile(*argv[]) on Thu, 22 May 2008 13:07:07 GMT]]></title><description><![CDATA[<p>Du könntest das aber eher so machen:</p>
<pre><code>Dateiname aus Kommanddozeile holen.
Wenn Endung = txt dann
   Datei oeffnen
andernfalls
   Fehler ausgeben (alternativ: txt erzwingen, indem es einfach angehangen wird)
Ende Wenn
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1514292</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1514292</guid><dc:creator><![CDATA[Tachyon]]></dc:creator><pubDate>Thu, 22 May 2008 13:07:07 GMT</pubDate></item></channel></rss>