<?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[fstream Probleme mit GCC]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe ein Beispielprogramm probiert, welches fehlschlug.<br />
Das Problem ist folgendes:</p>
<pre><code class="language-cpp">fstream f(&quot;test.dat&quot;, ios::in|ios::out|ios::binary );
</code></pre>
<p>sollte eine neue Datei erzeugen können, tut es aber nicht.</p>
<p>Das geht offenbar mit dem aktuellen GCC nicht mehr:<br />
<a href="http://gcc.gnu.org/ml/gcc-bugs/2002-04/msg01055.html" rel="nofollow">http://gcc.gnu.org/ml/gcc-bugs/2002-04/msg01055.html</a></p>
<p>Muß ich jetzt jedesmal erst testen, ob die Datei schon exisitiert,<br />
oder geht das einfacher?!</p>
<p>Danke,<br />
Stimpleton</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/152558/fstream-probleme-mit-gcc</link><generator>RSS for Node</generator><lastBuildDate>Mon, 07 Sep 2026 00:34:00 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/152558.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 07 Jul 2006 10:30:28 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to fstream Probleme mit GCC on Fri, 07 Jul 2006 10:30:28 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>ich habe ein Beispielprogramm probiert, welches fehlschlug.<br />
Das Problem ist folgendes:</p>
<pre><code class="language-cpp">fstream f(&quot;test.dat&quot;, ios::in|ios::out|ios::binary );
</code></pre>
<p>sollte eine neue Datei erzeugen können, tut es aber nicht.</p>
<p>Das geht offenbar mit dem aktuellen GCC nicht mehr:<br />
<a href="http://gcc.gnu.org/ml/gcc-bugs/2002-04/msg01055.html" rel="nofollow">http://gcc.gnu.org/ml/gcc-bugs/2002-04/msg01055.html</a></p>
<p>Muß ich jetzt jedesmal erst testen, ob die Datei schon exisitiert,<br />
oder geht das einfacher?!</p>
<p>Danke,<br />
Stimpleton</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1093106</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1093106</guid><dc:creator><![CDATA[stimpleton]]></dc:creator><pubDate>Fri, 07 Jul 2006 10:30:28 GMT</pubDate></item><item><title><![CDATA[Reply to fstream Probleme mit GCC on Fri, 07 Jul 2006 11:14:38 GMT]]></title><description><![CDATA[<p>was heißt denn &quot;fehlschlug&quot;?</p>
<p>Fehlermeldung?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1093142</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1093142</guid><dc:creator><![CDATA[ser1al]]></dc:creator><pubDate>Fri, 07 Jul 2006 11:14:38 GMT</pubDate></item><item><title><![CDATA[Reply to fstream Probleme mit GCC on Fri, 07 Jul 2006 11:50:09 GMT]]></title><description><![CDATA[<p>Fehlschlug:<br />
- keine Datei erzeugt (das ging früher mit der genannten Zeile)<br />
- f.good() liefert danach false (da es keine vorhandene Datei fand)</p>
<p>Die Interpretation dieser Zeile ist jetzt anders als in dem<br />
Beispielprogramm angenommen. Und ich habe keinen Modus gefunden,<br />
der folgendes tut:</p>
<p>- bestehnde Datei zum Lesen/Schreiben öffnen, falls vorhanden<br />
- neue Datei zum Lesen/Schreiben anlegen, falls noch nicht vorhanden</p>
<p>.. so war die Interpretation wohl früher.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1093188</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1093188</guid><dc:creator><![CDATA[stimpleton]]></dc:creator><pubDate>Fri, 07 Jul 2006 11:50:09 GMT</pubDate></item><item><title><![CDATA[Reply to fstream Probleme mit GCC on Fri, 07 Jul 2006 12:20:40 GMT]]></title><description><![CDATA[<p>Ich habe jetzt eine etwas unbefriedigende Lösung:</p>
<pre><code class="language-cpp">{
    	fstream test( filename, ios::in|ios::binary ); // does file exist?
		if(!test.good()) {	// no? -&gt; create new empty file
			fstream create( filename, ios::out|ios::trunc|ios::binary );
		}
    }
</code></pre>
<p>Dieser Block kommt vor das eigentliche Öffnen der Datei.</p>
<pre><code class="language-cpp">fstream file( filename, ios::in|ios::out|ios::binary );
</code></pre>
<p>Falls die Datei nicht zu öffnen ist, wird sie neu erstellt.<br />
(Blöd nur, wenn die Datei existiert und trotzdem nicht zu öffnen ist.)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1093216</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1093216</guid><dc:creator><![CDATA[stimpleton]]></dc:creator><pubDate>Fri, 07 Jul 2006 12:20:40 GMT</pubDate></item><item><title><![CDATA[Reply to fstream Probleme mit GCC on Fri, 07 Jul 2006 14:56:10 GMT]]></title><description><![CDATA[<p>Falls ein existierendes File überschrieben werden soll könnte man<br />
fstream file( filename, ios::in|ios::out|ios::binary|ios::trunc );<br />
schreiben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1093327</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1093327</guid><dc:creator><![CDATA[Braunstein]]></dc:creator><pubDate>Fri, 07 Jul 2006 14:56:10 GMT</pubDate></item></channel></rss>