<?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[File-Handling]]></title><description><![CDATA[<p>Hallo allerseits<br />
ich habe ein Prog, welches zu Begin eine log-Datei erzeugt (&quot;C:\\Programme\\ ... \\MeinProjekt\\Settings.log&quot;). In einem zweiten Schritt kopiere ich dann diverse Ordner/Files. Wenn ich dann am Schluss die log-Datei wieder öffnen will, falle ich beim Test in die Fehlerschleife...</p>
<pre><code class="language-cpp">if(!LogDatei) 
{
   //Fehler
}
else
{
   // Speichern in die Datei 
}
</code></pre>
<p>Weiss jemand, an was das liegen kann? Die Datei wurde korrekt erzeugt.....</p>
<p>Gruss Thomas</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/121438/file-handling</link><generator>RSS for Node</generator><lastBuildDate>Sat, 22 Aug 2026 19:23:00 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/121438.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 23 Sep 2005 11:20:50 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to File-Handling on Fri, 23 Sep 2005 11:20:50 GMT]]></title><description><![CDATA[<p>Hallo allerseits<br />
ich habe ein Prog, welches zu Begin eine log-Datei erzeugt (&quot;C:\\Programme\\ ... \\MeinProjekt\\Settings.log&quot;). In einem zweiten Schritt kopiere ich dann diverse Ordner/Files. Wenn ich dann am Schluss die log-Datei wieder öffnen will, falle ich beim Test in die Fehlerschleife...</p>
<pre><code class="language-cpp">if(!LogDatei) 
{
   //Fehler
}
else
{
   // Speichern in die Datei 
}
</code></pre>
<p>Weiss jemand, an was das liegen kann? Die Datei wurde korrekt erzeugt.....</p>
<p>Gruss Thomas</p>
]]></description><link>https://www.c-plusplus.net/forum/post/878500</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/878500</guid><dc:creator><![CDATA[black_sheep_thomas]]></dc:creator><pubDate>Fri, 23 Sep 2005 11:20:50 GMT</pubDate></item><item><title><![CDATA[Reply to File-Handling on Fri, 23 Sep 2005 11:26:14 GMT]]></title><description><![CDATA[<p>etwas mehr Code wäre hilfreich!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/878504</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/878504</guid><dc:creator><![CDATA[Airdamn]]></dc:creator><pubDate>Fri, 23 Sep 2005 11:26:14 GMT</pubDate></item><item><title><![CDATA[Reply to File-Handling on Fri, 23 Sep 2005 11:57:34 GMT]]></title><description><![CDATA[<p>black_sheep_thomas schrieb:</p>
<blockquote>
<p>Hallo allerseits<br />
ich habe ein Prog, welches zu Begin eine log-Datei erzeugt (&quot;C:\\Programme\\ ... \\MeinProjekt\\Settings.log&quot;). In einem zweiten Schritt kopiere ich dann diverse Ordner/Files. Wenn ich dann am Schluss die log-Datei wieder öffnen will, falle ich beim Test in die Fehlerschleife...</p>
<pre><code class="language-cpp">if(!LogDatei) 
{
   //Fehler
}
else
{
   // Speichern in die Datei 
}
</code></pre>
<p>Weiss jemand, an was das liegen kann? Die Datei wurde korrekt erzeugt.....</p>
<p>Gruss Thomas</p>
</blockquote>
<p>schau erstmal nach <a href="http://if-schleife.de/" rel="nofollow">http://if-schleife.de/</a><br />
und dann sag, was &quot;am schluß&quot; ist. so am schluß, daß die datei wieder zu ist? haste orgendwo LogDatei.close() aufgerufen (sollste eh nicht machen). warum überhaupt diese if-schleife? schreib doch einfach rein, und wenn's nicht klappt, klappt's halt nicht. wobei du natürlich einmal rausfinden mußt, warum's hier nicht klappt.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/878530</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/878530</guid><dc:creator><![CDATA[volkard]]></dc:creator><pubDate>Fri, 23 Sep 2005 11:57:34 GMT</pubDate></item><item><title><![CDATA[Reply to File-Handling on Sat, 24 Sep 2005 07:20:55 GMT]]></title><description><![CDATA[<p>Hier bitte:</p>
<pre><code class="language-cpp">const char szSettigFilePath[] = &quot;Settings.log&quot;;
char appPath[MAX_PATH];

// ...

// Den Pfad des Programmes ermitteln und an das Logfile anfügen
GetModuleFileName(NULL,appPath,sizeof(appPath)); // liefert z.B. &quot;c:\blupp\hallo.exe&quot;
PathRemoveFileSpec(appPath); // jetzt ist nur noch &quot;c:\blupp&quot; übrig
sprintf(appPath,&quot;%s\\%s&quot;,appPath,szSettigFilePath);

// Die Datei erzeugen
ofstream TempSettingFile(szSettigFilePath, ios::binary);
if(!TempSettingFile)
     MessageBox(0,&quot;Das Settingfile konnte nicht erzeugt werden&quot;,0,0);
else
   TempSettingFile.close();

// Nun wird mit FindFirstFile() und FindNextFile() gearbeitet
// ...
// ...

// Daten in die Datei speichern
ofstream SettingFile(appPath, ios::binary);
if(!SettingFile)
{
   // Hier falle ich beim Test jetzt rein, obwohl die Datei existiert
   MessageBox(0,&quot;Das Settingfile konnte nicht aktuallisiert werden&quot;,0,0);
}
else
{
   SettingFile.write((char*) &amp;AKTUELLE_VERSION,sizeof(AKTUELLE_VERSION));
   SettingFile.write((char*) &amp;m_startpfad,sizeof(m_startpfad));
   SettingFile.write((char*) &amp;m_zielpfad, sizeof(m_zielpfad));
}
SettingFile.close();
}

// Ende des Programms
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/878943</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/878943</guid><dc:creator><![CDATA[black_sheep_thomas]]></dc:creator><pubDate>Sat, 24 Sep 2005 07:20:55 GMT</pubDate></item><item><title><![CDATA[Reply to File-Handling on Sat, 24 Sep 2005 21:32:26 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">schreib doch einfach rein, und wenn's nicht klappt, klappt's halt nicht.
</code></pre>
<p>auch ne' Einstellung.....<br />
kann man mal was mehr Code sehn'?Vielleich den Header...</p>
]]></description><link>https://www.c-plusplus.net/forum/post/879384</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/879384</guid><dc:creator><![CDATA[Buddy Love]]></dc:creator><pubDate>Sat, 24 Sep 2005 21:32:26 GMT</pubDate></item><item><title><![CDATA[Reply to File-Handling on Sun, 25 Sep 2005 10:26:49 GMT]]></title><description><![CDATA[<p>Mehr Code wäre schon möglich, ist aber eine MFC-Klasse.</p>
<p>Ich habe das Problem jedoch in der Zwischenzeit &quot;gelöst&quot;. Das fstream-Obiekt jeweils wurde durch ein ifstream bzw. ofstream ersetzt und in in den einzelnen Methoden deklariert. -&gt; Jetzt läuft es ohne zu Probleme.</p>
<p>Gruss Thomas</p>
]]></description><link>https://www.c-plusplus.net/forum/post/879535</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/879535</guid><dc:creator><![CDATA[black_sheep_thomas]]></dc:creator><pubDate>Sun, 25 Sep 2005 10:26:49 GMT</pubDate></item><item><title><![CDATA[Reply to File-Handling on Sun, 25 Sep 2005 18:23:01 GMT]]></title><description><![CDATA[<p>Hi Thomas,<br />
neee,mit MFC kenn ich mich nu garnicht aus...Könntest mir da mal en' paar Tips geben wo man da ansetzt.....<br />
Ich doktor an der WIN32API rum und interessiere mich für Treiber und Kernel...also ganz unten im Keller gell!<br />
Bis dann</p>
]]></description><link>https://www.c-plusplus.net/forum/post/879909</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/879909</guid><dc:creator><![CDATA[Buddy Love]]></dc:creator><pubDate>Sun, 25 Sep 2005 18:23:01 GMT</pubDate></item><item><title><![CDATA[Reply to File-Handling on Mon, 26 Sep 2005 06:14:36 GMT]]></title><description><![CDATA[<p>Welchen Zweck verfolgst du mit folgendem Code?</p>
<pre><code class="language-cpp">// Die Datei erzeugen 
ofstream TempSettingFile(szSettigFilePath, ios::binary); 
if(!TempSettingFile) 
     MessageBox(0,&quot;Das Settingfile konnte nicht erzeugt werden&quot;,0,0); 
else 
   TempSettingFile.close(); // Erst öffnen, dann abfragen ob's geht und wenn ja, einfach wieder schließen???
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/880134</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/880134</guid><dc:creator><![CDATA[PuppetMaster2k]]></dc:creator><pubDate>Mon, 26 Sep 2005 06:14:36 GMT</pubDate></item><item><title><![CDATA[Reply to File-Handling on Mon, 26 Sep 2005 13:16:09 GMT]]></title><description><![CDATA[<p>PuppetMaster2k schrieb:</p>
<blockquote>
<p>Welchen Zweck verfolgst du mit folgendem Code?</p>
</blockquote>
<p>Der &quot;Sinn&quot; des Codes ist, eine leere Datei zu erzeugen. (ist aber in der aktuellen Programmversion nicht mehr enthalten)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/880433</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/880433</guid><dc:creator><![CDATA[black_sheep_thomas]]></dc:creator><pubDate>Mon, 26 Sep 2005 13:16:09 GMT</pubDate></item></channel></rss>