<?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[Hilfe mit IFSTREAM]]></title><description><![CDATA[<p>Hallo!</p>
<p>Ich habe folgendes Problem: ich will eine Menge Dateien einlesen, sozusagen alles von</p>
<p>file_0000.txt<br />
file_0001.txt<br />
file_0002.txt<br />
file_0003.txt<br />
.<br />
.<br />
.<br />
bis file_1000.txt</p>
<p>Ich weiss vorher aber nicht ob alle Dateien existieren. Daher dachte ich: wenn myInput.open(name);<br />
myinput==0 zurückgibt, zähle ich einfach den zähler hoch und gehe zur nächsten Datei.<br />
Folgendes passiert aber: wenn (myinput==0) einmal eingetreten ist ist myInput nicht mehr zu gebrauchen, auch wenn die nächste datei existiert bleibt (myinput==0)</p>
<p>hier der code wie er bis zur ersten fehlenden datei funktioniert:</p>
<p>int d1,d2,d3,d4,frame;<br />
ifstream myInput;</p>
<p>for(i=0;i&lt;basisnamelength;i++)tmpname[i]=basisname[i];</p>
<p>do{<br />
d1=frame/1000;<br />
d2=(frame-d1<em>1000)/100;<br />
d3=(frame-d1*1000-d2*100)/10;<br />
d4=frame-d1*1000-d2*100-d3</em>10;<br />
tmpname[basisnamelength]='_';<br />
tmpname[basisnamelength+1]=48+d1;<br />
tmpname[basisnamelength+2]=48+d2;<br />
tmpname[basisnamelength+3]=48+d3;<br />
tmpname[basisnamelength+4]=48+d4;<br />
tmpname[basisnamelength+5]='.';<br />
tmpname[basisnamelength+6]='t';<br />
tmpname[basisnamelength+7]='x';<br />
tmpname[basisnamelength+8]='t';<br />
tmpname[basisnamelength+9]=0;<br />
myInput.open(tmpname);<br />
frame++;<br />
}while(!myInput);</p>
<p>grüßße,</p>
<p>primatenreflexe</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/150710/hilfe-mit-ifstream</link><generator>RSS for Node</generator><lastBuildDate>Sat, 05 Sep 2026 20:29:58 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/150710.rss" rel="self" type="application/rss+xml"/><pubDate>Mon, 19 Jun 2006 16:44:33 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Hilfe mit IFSTREAM on Mon, 19 Jun 2006 16:44:33 GMT]]></title><description><![CDATA[<p>Hallo!</p>
<p>Ich habe folgendes Problem: ich will eine Menge Dateien einlesen, sozusagen alles von</p>
<p>file_0000.txt<br />
file_0001.txt<br />
file_0002.txt<br />
file_0003.txt<br />
.<br />
.<br />
.<br />
bis file_1000.txt</p>
<p>Ich weiss vorher aber nicht ob alle Dateien existieren. Daher dachte ich: wenn myInput.open(name);<br />
myinput==0 zurückgibt, zähle ich einfach den zähler hoch und gehe zur nächsten Datei.<br />
Folgendes passiert aber: wenn (myinput==0) einmal eingetreten ist ist myInput nicht mehr zu gebrauchen, auch wenn die nächste datei existiert bleibt (myinput==0)</p>
<p>hier der code wie er bis zur ersten fehlenden datei funktioniert:</p>
<p>int d1,d2,d3,d4,frame;<br />
ifstream myInput;</p>
<p>for(i=0;i&lt;basisnamelength;i++)tmpname[i]=basisname[i];</p>
<p>do{<br />
d1=frame/1000;<br />
d2=(frame-d1<em>1000)/100;<br />
d3=(frame-d1*1000-d2*100)/10;<br />
d4=frame-d1*1000-d2*100-d3</em>10;<br />
tmpname[basisnamelength]='_';<br />
tmpname[basisnamelength+1]=48+d1;<br />
tmpname[basisnamelength+2]=48+d2;<br />
tmpname[basisnamelength+3]=48+d3;<br />
tmpname[basisnamelength+4]=48+d4;<br />
tmpname[basisnamelength+5]='.';<br />
tmpname[basisnamelength+6]='t';<br />
tmpname[basisnamelength+7]='x';<br />
tmpname[basisnamelength+8]='t';<br />
tmpname[basisnamelength+9]=0;<br />
myInput.open(tmpname);<br />
frame++;<br />
}while(!myInput);</p>
<p>grüßße,</p>
<p>primatenreflexe</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1080756</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1080756</guid><dc:creator><![CDATA[primatenreflexe]]></dc:creator><pubDate>Mon, 19 Jun 2006 16:44:33 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe mit IFSTREAM on Mon, 19 Jun 2006 18:55:32 GMT]]></title><description><![CDATA[<p>myinput.close() schließt die datei und du kannst sie dann neu öffnen.</p>
<p>mfg.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1080876</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1080876</guid><dc:creator><![CDATA[joomoo]]></dc:creator><pubDate>Mon, 19 Jun 2006 18:55:32 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe mit IFSTREAM on Mon, 19 Jun 2006 18:58:24 GMT]]></title><description><![CDATA[<p>Und myinput.clear() löscht die Fehlerflags (nur close reicht imho nicht, kann mich aber irren)</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1080881</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1080881</guid><dc:creator><![CDATA[LordJaxom]]></dc:creator><pubDate>Mon, 19 Jun 2006 18:58:24 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe mit IFSTREAM on Mon, 19 Jun 2006 19:04:51 GMT]]></title><description><![CDATA[<p>LordJaxom schrieb:</p>
<blockquote>
<p>Und myinput.clear() löscht die Fehlerflags (nur close reicht imho nicht, kann mich aber irren)</p>
</blockquote>
<p>Stimmt, hab ich vergessen.</p>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/12730">@primatenreflexe</a><br />
Am einfachsten wär es natürlich wenn du immer ein neues fstream Objekt pro schleife hast, also es in der Schleife deklarierst.</p>
<p>mfg.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1080889</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1080889</guid><dc:creator><![CDATA[joomoo]]></dc:creator><pubDate>Mon, 19 Jun 2006 19:04:51 GMT</pubDate></item><item><title><![CDATA[Reply to Hilfe mit IFSTREAM on Mon, 19 Jun 2006 20:42:20 GMT]]></title><description><![CDATA[<p>für die Hilfe, ich werde es mal versuchen.<br />
Wusste nicht das es die &quot;clear&quot; methode gibt.<br />
um die zweifel auszuräumen: nur close reicht nicht, das hatte ich versucht.<br />
tschuess, rainer</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1080990</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1080990</guid><dc:creator><![CDATA[primatenreflexe]]></dc:creator><pubDate>Mon, 19 Jun 2006 20:42:20 GMT</pubDate></item></channel></rss>