<?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 wird nicht per ifstream geöffnet unter linux ...]]></title><description><![CDATA[<p>Hi,<br />
der folgende Snippet funktioniert aus irgendeinem Grunde leider nicht und ich frage mich warum ?<br />
Jedesmal springt die echo Funktion an und meint &quot;Couldn't open config&quot;.<br />
Die darunter liegende echo Funktion in der Schleife gibt gar nichts von sich.<br />
Die config datei existiert und hat alle lese und schreibrechte, aber irgendwie ... will er sie nicht. Warum ???</p>
<pre><code class="language-cpp">vector&lt;string&gt; res;
    string tmp;

    ifstream config_file;
    if(!config_file.is_open())
        config_file.open(&quot;config&quot;,  ios::app | ios::binary ); // open config.a

    if( ! config_file.good() )
        this-&gt;echo(&quot;Couldn't open config&quot;);

    while( getline( config_file, tmp, '\n' ) ){  //read loop, using string library function getline( istream&amp; f, string&amp; t, char delim)
        res.push_back( tmp );

        this-&gt;echo(tmp.c_str() );

        tmp.clear();
    }

    config_file.close() ;
</code></pre>
<p>Danke !</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/233723/datei-wird-nicht-per-ifstream-geöffnet-unter-linux</link><generator>RSS for Node</generator><lastBuildDate>Thu, 24 Sep 2026 20:37:52 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/233723.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 08 Feb 2009 11:28:33 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Datei wird nicht per ifstream geöffnet unter linux ... on Sun, 08 Feb 2009 11:28:33 GMT]]></title><description><![CDATA[<p>Hi,<br />
der folgende Snippet funktioniert aus irgendeinem Grunde leider nicht und ich frage mich warum ?<br />
Jedesmal springt die echo Funktion an und meint &quot;Couldn't open config&quot;.<br />
Die darunter liegende echo Funktion in der Schleife gibt gar nichts von sich.<br />
Die config datei existiert und hat alle lese und schreibrechte, aber irgendwie ... will er sie nicht. Warum ???</p>
<pre><code class="language-cpp">vector&lt;string&gt; res;
    string tmp;

    ifstream config_file;
    if(!config_file.is_open())
        config_file.open(&quot;config&quot;,  ios::app | ios::binary ); // open config.a

    if( ! config_file.good() )
        this-&gt;echo(&quot;Couldn't open config&quot;);

    while( getline( config_file, tmp, '\n' ) ){  //read loop, using string library function getline( istream&amp; f, string&amp; t, char delim)
        res.push_back( tmp );

        this-&gt;echo(tmp.c_str() );

        tmp.clear();
    }

    config_file.close() ;
</code></pre>
<p>Danke !</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1659891</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1659891</guid><dc:creator><![CDATA[Floyd]]></dc:creator><pubDate>Sun, 08 Feb 2009 11:28:33 GMT</pubDate></item><item><title><![CDATA[Reply to Datei wird nicht per ifstream geöffnet unter linux ... on Sun, 08 Feb 2009 11:38:24 GMT]]></title><description><![CDATA[<p>Heisst das file wirklich nur config, oder hat es noch eine Extension? - Und ist der Pfad sicher richtig?</p>
<p>Was enthält das File?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1659895</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1659895</guid><dc:creator><![CDATA[drakon]]></dc:creator><pubDate>Sun, 08 Feb 2009 11:38:24 GMT</pubDate></item><item><title><![CDATA[Reply to Datei wird nicht per ifstream geöffnet unter linux ... on Sun, 08 Feb 2009 11:40:39 GMT]]></title><description><![CDATA[<p>ich weis nicht<br />
aber good gibt glaube ich nicht wirklich genau das zurück was du willst<br />
und getline würde ich grade beim einlesen von dateien ohne das delim char verwenden</p>
<pre><code class="language-cpp">ifstream f(...);
if ( !f )
   echo(&quot;geht net&quot;);
else
  while ( !f.eof() )
  {
      getline(f, tmp);
      vector.push_back(tmp);
  }
</code></pre>
<p>so klappts auf jeden fall</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1659899</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1659899</guid><dc:creator><![CDATA[Skym0sh0]]></dc:creator><pubDate>Sun, 08 Feb 2009 11:40:39 GMT</pubDate></item><item><title><![CDATA[Reply to Datei wird nicht per ifstream geöffnet unter linux ... on Sun, 08 Feb 2009 12:05:51 GMT]]></title><description><![CDATA[<p>Hi,</p>
<p>ja, der Pfad stimmt. Die datei liegt *ohne anhängsel im namen - die heißt wirklich nur config* direkt neben der compilierten - ja, exe ist das ja unter linux nich...</p>
<p>ich hab die is_open() abfrage rausgenommen und das good() auch, sowie das delim char '\n' ... es geht trozdem nicht ?? !!</p>
<p>ich arbeite mit CodeBlocks, in der Debug configuration, falls das hilft...<br />
Danke schonmal !</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1659905</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1659905</guid><dc:creator><![CDATA[Floyd]]></dc:creator><pubDate>Sun, 08 Feb 2009 12:05:51 GMT</pubDate></item><item><title><![CDATA[Reply to Datei wird nicht per ifstream geöffnet unter linux ... on Sun, 08 Feb 2009 12:12:02 GMT]]></title><description><![CDATA[<p>-.- ich seh grad das ist binär oder?</p>
<p>das geht etwas anders<br />
guck da mal hier<br />
<a href="http://www.cplusplus.com/reference/iostream/ifstream/" rel="nofollow">http://www.cplusplus.com/reference/iostream/ifstream/</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1659908</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1659908</guid><dc:creator><![CDATA[Skym0sh0]]></dc:creator><pubDate>Sun, 08 Feb 2009 12:12:02 GMT</pubDate></item><item><title><![CDATA[Reply to Datei wird nicht per ifstream geöffnet unter linux ... on Sun, 08 Feb 2009 12:22:35 GMT]]></title><description><![CDATA[<p>danke, aber daran lags auch net ...<br />
Ich hab das ios::binary rausgenommen, geht trotzdem nicht...</p>
<p>Ich hab irgendwo mal gelesen, dass sich der LineEnd im nicht-binären modus zwischen Windoof und linux unterscheiden soll.<br />
Irgendeins von beiden brauch dann wohl noch einen Carriage return- stimmt, stimmt das halb oder gar nicht ?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1659915</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1659915</guid><dc:creator><![CDATA[Floyd]]></dc:creator><pubDate>Sun, 08 Feb 2009 12:22:35 GMT</pubDate></item><item><title><![CDATA[Reply to Datei wird nicht per ifstream geöffnet unter linux ... on Sun, 08 Feb 2009 12:27:49 GMT]]></title><description><![CDATA[<p>Strange thing here, really...</p>
<p>Also, was mich auch wundert ist, dass er das ios::app zu ignorieren scheint.<br />
Wenn ich ihm die datei mal wegnehme, erstellt er sie aber auch nicht oder so^^</p>
<p>Ach so, falls das auch noch eine rolle spielt, der QT moc läuft da auch noch drüber...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1659916</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1659916</guid><dc:creator><![CDATA[Floyd]]></dc:creator><pubDate>Sun, 08 Feb 2009 12:27:49 GMT</pubDate></item><item><title><![CDATA[Reply to Datei wird nicht per ifstream geöffnet unter linux ... on Sun, 08 Feb 2009 12:34:16 GMT]]></title><description><![CDATA[<p>Floyd schrieb:</p>
<blockquote>
<p>Ach so, falls das auch noch eine rolle spielt, der QT moc läuft da auch noch drüber...</p>
</blockquote>
<p>Hmmm. Warum verwendest du dann nicht gleich QFile?<br />
Wenn du so Probleme mit ifstream hast (und auch nicht auf den Kommentar von Skym0sh0 eingehen willst, für den es klappt) ist das sicherlich die Lösung.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1659919</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1659919</guid><dc:creator><![CDATA[franz]]></dc:creator><pubDate>Sun, 08 Feb 2009 12:34:16 GMT</pubDate></item><item><title><![CDATA[Reply to Datei wird nicht per ifstream geöffnet unter linux ... on Sun, 08 Feb 2009 12:41:45 GMT]]></title><description><![CDATA[<p>franz schrieb:</p>
<blockquote>
<p>Floyd schrieb:</p>
<blockquote>
<p>Ach so, falls das auch noch eine rolle spielt, der QT moc läuft da auch noch drüber...</p>
</blockquote>
<p>Hmmm. Warum verwendest du dann nicht gleich QFile?<br />
Wenn du so Probleme mit ifstream hast (und auch nicht auf den Kommentar von Skym0sh0 eingehen willst, für den es klappt) ist das sicherlich die Lösung.</p>
</blockquote>
<p>mhh.. weil ich ifstream kenne^^</p>
<p>Außerdem hab ich seine Lösung schon genau so eingebaut !!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1659921</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1659921</guid><dc:creator><![CDATA[Floyd]]></dc:creator><pubDate>Sun, 08 Feb 2009 12:41:45 GMT</pubDate></item><item><title><![CDATA[Reply to Datei wird nicht per ifstream geöffnet unter linux ... on Sun, 08 Feb 2009 12:43:14 GMT]]></title><description><![CDATA[<p>Alles klar, er kam mit dem ios::app nicht zurecht - warum eigentlich nicht ??</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1659922</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1659922</guid><dc:creator><![CDATA[Floyd]]></dc:creator><pubDate>Sun, 08 Feb 2009 12:43:14 GMT</pubDate></item><item><title><![CDATA[Reply to Datei wird nicht per ifstream geöffnet unter linux ... on Sun, 08 Feb 2009 13:48:47 GMT]]></title><description><![CDATA[<p>Vielleicht weil es ein Input Stream ist und ios::app (fuer append) eine &quot;Outputoperation&quot; ist?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1659939</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1659939</guid><dc:creator><![CDATA[knivil]]></dc:creator><pubDate>Sun, 08 Feb 2009 13:48:47 GMT</pubDate></item><item><title><![CDATA[Reply to Datei wird nicht per ifstream geöffnet unter linux ... on Sun, 08 Feb 2009 17:25:02 GMT]]></title><description><![CDATA[<p>Mhh... da muss ich mich verlesen haben. Ich dachte, ios::app würde bewirken, dass die Datei erstellt wird, wenn sie nicht vorhanden ist.<br />
Aber gut, vielen Dank an Alle !</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1660072</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1660072</guid><dc:creator><![CDATA[Floyd]]></dc:creator><pubDate>Sun, 08 Feb 2009 17:25:02 GMT</pubDate></item></channel></rss>