<?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 einlesen]]></title><description><![CDATA[<p>hallo,</p>
<p>kann mir jemand sagen, wie ich das einlesen einer ascii datei anhalte und später (auf Knopfdruck) an dieser stelle fortführe?</p>
<p>Die Datei sieht so aus:</p>
<p>123 231 324<br />
123 123 123<br />
43 54 4<br />
****<br />
12 34 5<br />
234 323 100<br />
239 8 9<br />
****</p>
<p>und so weiter bei den sternchen möchte ich anhalten und auf wunsch dann den nächsten block einlesen</p>
<p>vielen dank</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/259115/datei-einlesen</link><generator>RSS for Node</generator><lastBuildDate>Wed, 09 Sep 2026 01:19:38 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/259115.rss" rel="self" type="application/rss+xml"/><pubDate>Tue, 19 Jan 2010 11:06:01 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to datei einlesen on Tue, 19 Jan 2010 11:06:01 GMT]]></title><description><![CDATA[<p>hallo,</p>
<p>kann mir jemand sagen, wie ich das einlesen einer ascii datei anhalte und später (auf Knopfdruck) an dieser stelle fortführe?</p>
<p>Die Datei sieht so aus:</p>
<p>123 231 324<br />
123 123 123<br />
43 54 4<br />
****<br />
12 34 5<br />
234 323 100<br />
239 8 9<br />
****</p>
<p>und so weiter bei den sternchen möchte ich anhalten und auf wunsch dann den nächsten block einlesen</p>
<p>vielen dank</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1841282</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1841282</guid><dc:creator><![CDATA[gast555]]></dc:creator><pubDate>Tue, 19 Jan 2010 11:06:01 GMT</pubDate></item><item><title><![CDATA[Reply to datei einlesen on Tue, 19 Jan 2010 11:08:44 GMT]]></title><description><![CDATA[<p>Ganz einfach: du liest einfach nicht weiter ein, an der Stelle. Wo ist das Problem?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1841287</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1841287</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Tue, 19 Jan 2010 11:08:44 GMT</pubDate></item><item><title><![CDATA[Reply to datei einlesen on Tue, 19 Jan 2010 11:13:14 GMT]]></title><description><![CDATA[<p>da aufzuhören geht ja, aber dann klappts mit dem weiterlesen eben nicht</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1841293</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1841293</guid><dc:creator><![CDATA[gast555]]></dc:creator><pubDate>Tue, 19 Jan 2010 11:13:14 GMT</pubDate></item><item><title><![CDATA[Reply to datei einlesen on Tue, 19 Jan 2010 11:16:58 GMT]]></title><description><![CDATA[<p>Weil? Code?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1841294</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1841294</guid><dc:creator><![CDATA[Fellhuhn]]></dc:creator><pubDate>Tue, 19 Jan 2010 11:16:58 GMT</pubDate></item><item><title><![CDATA[Reply to datei einlesen on Tue, 19 Jan 2010 11:17:17 GMT]]></title><description><![CDATA[<p>Du machst einfach genau das gleiche wie beim ersten Teilstück!</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1841295</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1841295</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Tue, 19 Jan 2010 11:17:17 GMT</pubDate></item><item><title><![CDATA[Reply to datei einlesen on Tue, 19 Jan 2010 11:23:27 GMT]]></title><description><![CDATA[<p>Entweder merkst du dir die Position und springst dann dort wieder hin oder läßt den Dateihandle offen.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1841299</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1841299</guid><dc:creator><![CDATA[Fellhuhn]]></dc:creator><pubDate>Tue, 19 Jan 2010 11:23:27 GMT</pubDate></item><item><title><![CDATA[Reply to datei einlesen on Tue, 19 Jan 2010 11:40:01 GMT]]></title><description><![CDATA[<p>das ist die funktion zum einlesen in c (die ist nicht von mir sondern schon in einem Program enthalten was ich ändern soll), hier wird genau ein datenblock eingelesen.<br />
aber wenn ich nur das close() weglasse und diese funktion erneut aufrufe klappt das nicht.</p>
<pre><code>void Einlesen3D(char *Name)
{
 fp2=fopen(Name, &quot;r&quot;);

 //einlesen anzahl Dreiecke und Knotenpunkte

 fscanf(fp2,&quot;%i %i&quot;, &amp;AnzahlDreiecke, &amp;AnzahlKnotenpunkte );

 //einlesen von Topologie der dreiecke
 for(int i=0; i&lt;=AnzahlDreiecke-1; i++)
 fscanf(fp2, &quot;%i %i %i %i&quot;,&amp;Dreiecke[i][0], &amp;Dreiecke[i][1], &amp;Dreiecke[i][2], &amp;Dreiecke[i][3] );

 //einlesen von koordinaten
 for(int i=0; i&lt;=AnzahlKnotenpunkte-1;i++)
 fscanf(fp2,&quot;%i %e %e %e&quot;, &amp;a[i], &amp;x[i], &amp;y[i],&amp;z[i]);

 //fclose(fp2);
}
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1841304</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1841304</guid><dc:creator><![CDATA[gast555]]></dc:creator><pubDate>Tue, 19 Jan 2010 11:40:01 GMT</pubDate></item><item><title><![CDATA[Reply to datei einlesen on Tue, 19 Jan 2010 11:45:54 GMT]]></title><description><![CDATA[<p>gast555 schrieb:</p>
<blockquote>
<p>aber wenn ich nur das close() weglasse und diese funktion erneut aufrufe klappt das nicht.</p>
</blockquote>
<p>Könnte dran liegen, dass die Datei zuerst geschlossen werden muss, bevor sie wieder geöffnet werden kann. <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f4a1.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--light_bulb"
      title=":bulb:"
      alt="💡"
    /></p>
<p>In C++ gibt es übrigens <code>std::fstream</code> , damit kann dir sowas nicht passieren, weil der Destruktor die Datei automatisch schliesst.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1841309</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1841309</guid><dc:creator><![CDATA[Nexus]]></dc:creator><pubDate>Tue, 19 Jan 2010 11:45:54 GMT</pubDate></item><item><title><![CDATA[Reply to datei einlesen on Tue, 19 Jan 2010 11:51:11 GMT]]></title><description><![CDATA[<p>ich wollte mit möglichst wenig aufwand, den code anpassen, wenn ich die datei wieder schließe ist doch auch die aktuelle position weg, wäre es möglich diese mit tellg() in eine globale variable zu schieben?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1841312</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1841312</guid><dc:creator><![CDATA[gast555]]></dc:creator><pubDate>Tue, 19 Jan 2010 11:51:11 GMT</pubDate></item><item><title><![CDATA[Reply to datei einlesen on Tue, 19 Jan 2010 11:55:43 GMT]]></title><description><![CDATA[<p>... dann wirst du ein Problem damit bekommen wenn du unterschiedliche Dateien lesen willst. Daher wäre es wenn sinnvoller statt dem Dateinamen den Filehandle zu übergeben und diesen außerhalb der Methode zu sichern. Oder die Funktion gibt die Stelle zurück an der sie aufgehört hat zu lesen und du übergibst ihr als zusätzlichen Parameter (mit Defaultwert 0) die letzte Position.</p>
<p>Gibt viele Möglichkeiten.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1841317</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1841317</guid><dc:creator><![CDATA[Fellhuhn]]></dc:creator><pubDate>Tue, 19 Jan 2010 11:55:43 GMT</pubDate></item><item><title><![CDATA[Reply to datei einlesen on Tue, 19 Jan 2010 12:00:29 GMT]]></title><description><![CDATA[<p>ok, wie kann ich die aktuelle position als returnwert bekommen?</p>
<pre><code>return tellg();
</code></pre>
<p>???</p>
<p>das geht ja so bestimmt nicht</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1841322</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1841322</guid><dc:creator><![CDATA[gast555]]></dc:creator><pubDate>Tue, 19 Jan 2010 12:00:29 GMT</pubDate></item><item><title><![CDATA[Reply to datei einlesen on Tue, 19 Jan 2010 12:30:09 GMT]]></title><description><![CDATA[<p>kann mir bitte jemand noch einen tip geben, ich bekomme es nicht hin <img
      src="https://www.c-plusplus.net/forum/plugins/nodebb-plugin-emoji/emoji/emoji-one/1f644.png?v=ab1pehoraso"
      class="not-responsive emoji emoji-emoji-one emoji--face_with_rolling_eyes"
      title=":rolling_eyes:"
      alt="🙄"
    /></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1841347</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1841347</guid><dc:creator><![CDATA[gast555]]></dc:creator><pubDate>Tue, 19 Jan 2010 12:30:09 GMT</pubDate></item><item><title><![CDATA[Reply to datei einlesen on Tue, 19 Jan 2010 12:57:03 GMT]]></title><description><![CDATA[<p>oder ein Beispiel zeigen????? hilfe</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1841358</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1841358</guid><dc:creator><![CDATA[gast555]]></dc:creator><pubDate>Tue, 19 Jan 2010 12:57:03 GMT</pubDate></item><item><title><![CDATA[Reply to datei einlesen on Tue, 19 Jan 2010 13:01:17 GMT]]></title><description><![CDATA[<p><a href="http://fruiture.de/perl/questions.html" rel="nofollow">Wie man Fragen richtig stellt.</a></p>
]]></description><link>https://www.c-plusplus.net/forum/post/1841361</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1841361</guid><dc:creator><![CDATA[SeppJ]]></dc:creator><pubDate>Tue, 19 Jan 2010 13:01:17 GMT</pubDate></item><item><title><![CDATA[Reply to datei einlesen on Tue, 19 Jan 2010 13:02:59 GMT]]></title><description><![CDATA[<pre><code class="language-cpp">bool CChipDoc::GetFileInfo()
{

	std::fstream InputFile;
	bool found = false;
	char cc;  

	InputFile.open(m_sFileName, std::ios_base::binary | std::ios::in | std::ios::out);
	if( !InputFile ) 
	{
		std::cout &lt;&lt; &quot;Error opening input stream&quot; &lt;&lt; std::endl;
		return false;
	}
	m_nHeaderLength = 0;
	while( (cc = InputFile.get()) != InputFile.eof() &amp;&amp; !found)
	{
		if(cc == 80)
		{
			found = true;
			break;
		}
		m_nHeaderLength++;

	}
	m_nLineLength = 2;
	while((cc = InputFile.get()) != InputFile.eof() &amp;&amp; cc != 10)
	{	
		m_nLineLength++;
	}

	InputFile.close();

	return true;
}

bool CChipDoc::WritePadToFile(CPad* pPad)
{
//	CChipType* pChip = (CChipType*) m_pBondType;
//	ASSERT (pChip != NULL);

	std::fstream InputFile;
	CString NL = &quot;\r\n&quot;;	

	InputFile.open(m_sFileName, std::ios_base::binary | std::ios::in | std::ios::out);
	if( !InputFile ) 
	{
		std::cout &lt;&lt; &quot;Error opening input stream&quot; &lt;&lt; std::endl;
		return false;
	}
        //random string anlegen... hauptsache zeilenlänge stimmt...

	InputFile.seekp(m_nHeaderLength + Name*m_nLineLength);
	InputFile.write(str, m_nLineLength-1);

	InputFile.close();
	return true;
}
</code></pre>
<p>was einfacheres habsch gerad nicht da. sry. kompiliert aber xD</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1841363</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1841363</guid><dc:creator><![CDATA[Barados]]></dc:creator><pubDate>Tue, 19 Jan 2010 13:02:59 GMT</pubDate></item></channel></rss>