<?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[System::IO::File::Exists ohne .NET]]></title><description><![CDATA[<p>Die meisten werden mich wahrscheinlich für blöd halten so ne Frage zu stellen.<br />
Ich hab so was halt noch nie gebraucht, da ich nur Spiele mit Allegro programmiere. Die sollen halt nicht auf .Net angewiesen sein.</p>
<p>Ich suche eine c++ Funktion, die kein .Net beansprucht in der Form vom .Net:</p>
<p>bool Exists(const char* filename)</p>
<p>Kann mir jemand helfen?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/267551/system-io-file-exists-ohne-net</link><generator>RSS for Node</generator><lastBuildDate>Wed, 02 Sep 2026 09:36:55 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/267551.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 26 May 2010 13:05:25 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to System::IO::File::Exists ohne .NET on Wed, 26 May 2010 13:05:25 GMT]]></title><description><![CDATA[<p>Die meisten werden mich wahrscheinlich für blöd halten so ne Frage zu stellen.<br />
Ich hab so was halt noch nie gebraucht, da ich nur Spiele mit Allegro programmiere. Die sollen halt nicht auf .Net angewiesen sein.</p>
<p>Ich suche eine c++ Funktion, die kein .Net beansprucht in der Form vom .Net:</p>
<p>bool Exists(const char* filename)</p>
<p>Kann mir jemand helfen?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1902720</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1902720</guid><dc:creator><![CDATA[Samxxxx]]></dc:creator><pubDate>Wed, 26 May 2010 13:05:25 GMT</pubDate></item><item><title><![CDATA[Reply to System::IO::File::Exists ohne .NET on Wed, 26 May 2010 13:23:05 GMT]]></title><description><![CDATA[<p><a href="http://www.boost.org/doc/libs/1_43_0/libs/filesystem/doc/index.htm" rel="nofollow"><em>Boost.Filesystem</em></a> hat eine Funktion <code>exists()</code> . Falls du die Boost-Bibliothek noch nicht hast, kannst du sie dir ja trotzdem mal anschauen, sie beinhaltet sehr viele nützliche Dinge für den C++-Alltag.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1902735</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1902735</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Wed, 26 May 2010 13:23:05 GMT</pubDate></item><item><title><![CDATA[Reply to System::IO::File::Exists ohne .NET on Wed, 26 May 2010 16:51:55 GMT]]></title><description><![CDATA[<p>Hey.</p>
<p>Deine Frage hat mein Interesse geweckt und ich dachte ich programmier mal was.<br />
Ist vielleicht bisschen gehackt aber es geht ^^:</p>
<pre><code class="language-cpp">#include &lt;iostream&gt;
#include &lt;fstream&gt;

bool fileExists(char *filename)
{
  std::ifstream stream(filename);
  return (stream!=NULL);
}

int main(int argc, char *argv[])
{
  if(argv[1] == NULL)
    {
      std::cout &lt;&lt; &quot;Incorrect program arguments. Usage: ./file_exists myfile.dat\n&quot;;
      return -1;
    }

  std::cout &lt;&lt; &quot;The file &quot; &lt;&lt; (fileExists(argv[1]) ? &quot;exists\n&quot; : &quot;does not exist\n&quot;);
  return 0;
}
</code></pre>
<p>Also eigentlich ist nur die fileExists Funktion wichtig. Das Programm kannst du in der Konsole mit dem entsprechendem Filenamen als Program Argument ausführen.</p>
<p>Grüße</p>
<p>Max</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1902848</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1902848</guid><dc:creator><![CDATA[Max3000]]></dc:creator><pubDate>Wed, 26 May 2010 16:51:55 GMT</pubDate></item><item><title><![CDATA[Reply to System::IO::File::Exists ohne .NET on Wed, 26 May 2010 18:34:03 GMT]]></title><description><![CDATA[<blockquote>
<p>&gt; Ist vielleicht bisschen gehackt aber es geht ^^:</p>
</blockquote>
<p>Nein, es geht nicht. Wenn die Datei Rechte erfordert, die der Nutzer nicht hat, scheitert das Programm.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1902897</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1902897</guid><dc:creator><![CDATA[Ad aCTa]]></dc:creator><pubDate>Wed, 26 May 2010 18:34:03 GMT</pubDate></item><item><title><![CDATA[Reply to System::IO::File::Exists ohne .NET on Wed, 26 May 2010 21:45:35 GMT]]></title><description><![CDATA[<p>Korrigiert mich wenn ich falsch liege, aber das kann doch gar nicht funktionieren. Wie kann denn ein ifstream bitte NULL sein??? Wenn überhaupt dann is_open(), was aber die von Ad Acta angesprochene Problematik hat, dass false nicht zwingend bedeutet dass die Datei nicht exisitiert.</p>
<p>Eine andere Idee wäre noch eine Datei mit dem Namen zu erzeugen und falls dies scheitert zu schließen, dass bereits eine Datei mit diesem Namen existiert. Es ist aber auch hier genausogut möglich dass man einfach keine Schreibrechte in diesem Verzeichnis besitzt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1902976</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1902976</guid><dc:creator><![CDATA[OhneName]]></dc:creator><pubDate>Wed, 26 May 2010 21:45:35 GMT</pubDate></item><item><title><![CDATA[Reply to System::IO::File::Exists ohne .NET on Thu, 27 May 2010 00:16:48 GMT]]></title><description><![CDATA[<p>OhneName schrieb:</p>
<blockquote>
<p>Korrigiert mich wenn ich falsch liege, aber das kann doch gar nicht funktionieren. Wie kann denn ein ifstream bitte NULL sein??? Wenn überhaupt dann is_open(), was aber die von Ad Acta angesprochene Problematik hat, dass false nicht zwingend bedeutet dass die Datei nicht exisitiert.</p>
</blockquote>
<p>Also bei mir hats funktioniert.<br />
Natürlich hatte ich alle nötigen Rechte.<br />
Der Konstruktor setzt bei ifstream vorraus, dass das File existiert. Wenn nicht gibts auch keinen Stream.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1903009</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1903009</guid><dc:creator><![CDATA[Max3000]]></dc:creator><pubDate>Thu, 27 May 2010 00:16:48 GMT</pubDate></item><item><title><![CDATA[Reply to System::IO::File::Exists ohne .NET on Thu, 27 May 2010 06:42:21 GMT]]></title><description><![CDATA[<p>Max3000 schrieb:</p>
<blockquote>
<p>Der Konstruktor setzt bei ifstream v******, dass das File existiert. Wenn nicht gibts auch keinen Stream.</p>
</blockquote>
<p>Er setzt voraus dass das File existiert und geöffnet werden kann. Den Stream gibts so oder so, nur hat er bei fehlgeschlagenem Ctor das Statusflag auf false.</p>
<p>Wenn das file zwar existiert, aber nicht geöffnet werden kann (aus welchem Grund auch immer), dann gibt deine file_exists-Funktion auch false zurück, behauptet also, dass die Datei nicht existiert - was dann eben nicht richtig ist.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1903029</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1903029</guid><dc:creator><![CDATA[pumuckl]]></dc:creator><pubDate>Thu, 27 May 2010 06:42:21 GMT</pubDate></item><item><title><![CDATA[Reply to System::IO::File::Exists ohne .NET on Thu, 27 May 2010 07:12:46 GMT]]></title><description><![CDATA[<p>OhneName schrieb:</p>
<blockquote>
<p>Wie kann denn ein ifstream bitte NULL sein???</p>
</blockquote>
<p><a href="http://www.cplusplus.com/reference/iostream/ios/operator_voidpt/" rel="nofollow">http://www.cplusplus.com/reference/iostream/ios/operator_voidpt/</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1903038</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1903038</guid><dc:creator><![CDATA[l&#x27;abra d&#x27;or]]></dc:creator><pubDate>Thu, 27 May 2010 07:12:46 GMT</pubDate></item><item><title><![CDATA[Reply to System::IO::File::Exists ohne .NET on Thu, 27 May 2010 07:16:26 GMT]]></title><description><![CDATA[<p>OhneName schrieb:</p>
<blockquote>
<p>Korrigiert mich wenn ich falsch liege, aber das kann doch gar nicht funktionieren. Wie kann denn ein ifstream bitte NULL sein???</p>
</blockquote>
<p><a href="http://www.cplusplus.com/reference/iostream/ios/operator_voidpt/" rel="nofollow">So kann er das...</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1903039</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1903039</guid><dc:creator><![CDATA[Tachyon]]></dc:creator><pubDate>Thu, 27 May 2010 07:16:26 GMT</pubDate></item><item><title><![CDATA[Reply to System::IO::File::Exists ohne .NET on Thu, 27 May 2010 14:45:29 GMT]]></title><description><![CDATA[<p>l'abra d'or schrieb:</p>
<blockquote>
<p>OhneName schrieb:</p>
<blockquote>
<p>Wie kann denn ein ifstream bitte NULL sein???</p>
</blockquote>
<p><a href="http://www.cplusplus.com/reference/iostream/ios/operator_voidpt/" rel="nofollow">http://www.cplusplus.com/reference/iostream/ios/operator_voidpt/</a></p>
</blockquote>
<p>Danke, da bin ich nicht draufgekommen obwohl man ihn beim !-Operator ja indirekt ständig benutzt. Sonderlich intuitiv finde ich diese Verwendung mit &quot;== NULL&quot; aber nicht.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1903264</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1903264</guid><dc:creator><![CDATA[OhneName]]></dc:creator><pubDate>Thu, 27 May 2010 14:45:29 GMT</pubDate></item></channel></rss>