<?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[Datei als Argument in Funktion auf Existenz prüfen]]></title><description><![CDATA[<p>Ich bin noch relativ unbewandert in C++, aber ich hoffe Ihr könnt mir weiterhelfen.<br />
Ich habe hier einen Beispiel-Code, den ich zur Existenzprüfung einer Datei verwende. Es wir nur True oder False zurückgegeben.<br />
Ich möchte den Code allerdings universeller haben, so dass ich nur eine gewünschte Datei als Argument einbaue, etwa so:</p>
<pre><code>bool FileExist( &quot;/var/beispiel.txt&quot; )
</code></pre>
<p>Hier das Original:</p>
<pre><code>bool FileExist( void )
{
// pruefe Existenz einer Datei 
if( (access( &quot;/var/beispiel.txt&quot;, 0 )) != -1 )
    return true;
  else
    return false;
}
</code></pre>
<p>Ich komme da leider nicht recht weiter.</p>
<p>Im Voraus Danke!</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/145786/datei-als-argument-in-funktion-auf-existenz-prüfen</link><generator>RSS for Node</generator><lastBuildDate>Thu, 03 Sep 2026 09:14:39 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/145786.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 01 May 2006 12:29:11 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Datei als Argument in Funktion auf Existenz prüfen on Mon, 01 May 2006 12:29:11 GMT]]></title><description><![CDATA[<p>Ich bin noch relativ unbewandert in C++, aber ich hoffe Ihr könnt mir weiterhelfen.<br />
Ich habe hier einen Beispiel-Code, den ich zur Existenzprüfung einer Datei verwende. Es wir nur True oder False zurückgegeben.<br />
Ich möchte den Code allerdings universeller haben, so dass ich nur eine gewünschte Datei als Argument einbaue, etwa so:</p>
<pre><code>bool FileExist( &quot;/var/beispiel.txt&quot; )
</code></pre>
<p>Hier das Original:</p>
<pre><code>bool FileExist( void )
{
// pruefe Existenz einer Datei 
if( (access( &quot;/var/beispiel.txt&quot;, 0 )) != -1 )
    return true;
  else
    return false;
}
</code></pre>
<p>Ich komme da leider nicht recht weiter.</p>
<p>Im Voraus Danke!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1048901</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1048901</guid><dc:creator><![CDATA[dixidix]]></dc:creator><pubDate>Mon, 01 May 2006 12:29:11 GMT</pubDate></item><item><title><![CDATA[Reply to Datei als Argument in Funktion auf Existenz prüfen on Mon, 01 May 2006 13:59:38 GMT]]></title><description><![CDATA[<p>wo kommst du nicht weiter? Lies vielleicht mal ein Tutorial</p>
<p><a href="http://tutorial.schornboeck.net/" rel="nofollow">http://tutorial.schornboeck.net/</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1048952</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1048952</guid><dc:creator><![CDATA[rüdiger]]></dc:creator><pubDate>Mon, 01 May 2006 13:59:38 GMT</pubDate></item><item><title><![CDATA[Reply to Datei als Argument in Funktion auf Existenz prüfen on Mon, 01 May 2006 14:00:00 GMT]]></title><description><![CDATA[<p>Dieser Thread wurde von Moderator/in <a href="http://www.c-plusplus.net/forum/profile.php?mode=viewprofile&amp;u=1819" rel="nofollow">kingruedi</a> aus dem Forum <a href="http://www.c-plusplus.net/forum/viewforum.php?f=5" rel="nofollow">Linux/Unix</a> in das Forum <a href="http://www.c-plusplus.net/forum/viewforum.php?f=15" rel="nofollow">C++</a> verschoben.</p>
<p>Im Zweifelsfall bitte auch folgende Hinweise beachten:<br />
<a href="http://www.c-plusplus.net/forum/viewtopic.php?t=39405" rel="nofollow">C/C++ Forum :: FAQ - Sonstiges :: Wohin mit meiner Frage?</a></p>
<p><em>Dieses Posting wurde automatisch erzeugt.</em></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1048953</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1048953</guid><dc:creator><![CDATA[C++ Forumbot]]></dc:creator><pubDate>Mon, 01 May 2006 14:00:00 GMT</pubDate></item><item><title><![CDATA[Reply to Datei als Argument in Funktion auf Existenz prüfen on Mon, 01 May 2006 15:18:24 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>Du kannst auch boost benutzen, da gibt es eine Funktion mit dem Namen exists, die überprüft, ob die übergebene Datei existiert.</p>
<p>chrische</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1049032</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1049032</guid><dc:creator><![CDATA[[[global:guest]]]]></dc:creator><pubDate>Mon, 01 May 2006 15:18:24 GMT</pubDate></item><item><title><![CDATA[Reply to Datei als Argument in Funktion auf Existenz prüfen on Mon, 01 May 2006 17:13:42 GMT]]></title><description><![CDATA[<p>So hatte ich das zuletzt gemacht, aber das will nicht:<br />
Fehlermeldung: [quote]expected primary-expression before &quot;path&quot;</p>
<p>boost kenne ich noch nicht!</p>
<pre><code>#include &lt;stdio.h&gt;
#include &lt;iostream&gt;
#include &lt;fstream&gt;
#include &lt;string&gt;
using namespace std;

bool FileExist(string); 

bool FileExist(string path)
{
if( (access( string path, 0 )) != -1 )
    return true;
else
    return false;
}
.
.
.
.
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1049111</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1049111</guid><dc:creator><![CDATA[dixidix]]></dc:creator><pubDate>Mon, 01 May 2006 17:13:42 GMT</pubDate></item><item><title><![CDATA[Reply to Datei als Argument in Funktion auf Existenz prüfen on Mon, 01 May 2006 17:23:19 GMT]]></title><description><![CDATA[<p>Hallo</p>
<pre><code class="language-cpp">if( (access(path, 0 )) != -1 )
</code></pre>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1049115</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1049115</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Mon, 01 May 2006 17:23:19 GMT</pubDate></item><item><title><![CDATA[Reply to Datei als Argument in Funktion auf Existenz prüfen on Mon, 01 May 2006 17:34:46 GMT]]></title><description><![CDATA[<p>Danke für die schnelle Antwort.<br />
Ich habs mal getestet:</p>
<pre><code class="language-cpp">#include &lt;stdio.h&gt;
#include &lt;iostream&gt;
#include &lt;fstream&gt;
#include &lt;string&gt;
using namespace std;

bool FileExist(string); 

bool FileExist(string path)
{
if( (access( path, 0 )) != -1 )
    return true;
else
    return false;
}
</code></pre>
<p>Ich bekomme aber aber dann diese Fehlermeldung:</p>
<blockquote>
<p>cannot convert 'std::string' to 'const char*' for argument '1' to 'int access(const char*,int)'</p>
</blockquote>
]]></description><link>https://www.c-plusplus.net/forum/post/1049122</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1049122</guid><dc:creator><![CDATA[dixidix]]></dc:creator><pubDate>Mon, 01 May 2006 17:34:46 GMT</pubDate></item><item><title><![CDATA[Reply to Datei als Argument in Funktion auf Existenz prüfen on Mon, 01 May 2006 17:38:19 GMT]]></title><description><![CDATA[<p>Hallo</p>
<p>mach dich unbedingt in einem tutorial erstmal mit den C++ grundlagen vertraut</p>
<pre><code class="language-cpp">if( (access( path.c_str(), 0 )) != -1 )
</code></pre>
<p>bis bald<br />
akari</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1049125</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1049125</guid><dc:creator><![CDATA[akari]]></dc:creator><pubDate>Mon, 01 May 2006 17:38:19 GMT</pubDate></item><item><title><![CDATA[Reply to Datei als Argument in Funktion auf Existenz prüfen on Mon, 01 May 2006 17:41:11 GMT]]></title><description><![CDATA[<p>Danke hat geklappt!<br />
Durch Tutorials wühle ich mich momentan schon durch, und das wird wohl auch noch einige Zeit in Anspruch nehmen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1049127</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1049127</guid><dc:creator><![CDATA[dixidix]]></dc:creator><pubDate>Mon, 01 May 2006 17:41:11 GMT</pubDate></item></channel></rss>