<?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>lese mit folgender Funktion den Inhalt einer Datei ein:</p>
<pre><code class="language-cpp">void CDateiLesenDlg::OnLesen() 
{
	CFileFind Find;

	char szPuffer[500];

	CFile myFile;
	CFileException fileException;

	BOOL bFind = Find.FindFile(&quot;D:\\GDT_I\\*.txt&quot;, 0);

	while(bFind)
	{
		bFind = Find.FindNextFile();

		m_sDateiName = Find.GetFileName();

		myFile.Open(m_sDateiName, CFile::modeReadWrite, &amp;fileException);

		int i = myFile.GetLength();

		myFile.Read(szPuffer, sizeof (szPuffer));

		m_sInhalt = szPuffer;
		m_sTempInhalt = szPuffer;

		UpdateData(FALSE);
	}
}
</code></pre>
<p>Mein Problem:<br />
Ich möchte meinen CString m_sInhalt nicht 500Byte gross haben, sondern nur i bytes.</p>
<p>Meine Löung wäre i merken, und im CString ein delete von 500 - i.<br />
Ist ein bisschen umständlich, geht das nicht einfacher?</p>
<p>Gruss Sven</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/148402/datei-einlesen</link><generator>RSS for Node</generator><lastBuildDate>Sat, 18 Jul 2026 22:06:04 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/148402.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 26 May 2006 11:36:19 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Datei einlesen. on Fri, 26 May 2006 11:36:19 GMT]]></title><description><![CDATA[<p>Hallo,</p>
<p>lese mit folgender Funktion den Inhalt einer Datei ein:</p>
<pre><code class="language-cpp">void CDateiLesenDlg::OnLesen() 
{
	CFileFind Find;

	char szPuffer[500];

	CFile myFile;
	CFileException fileException;

	BOOL bFind = Find.FindFile(&quot;D:\\GDT_I\\*.txt&quot;, 0);

	while(bFind)
	{
		bFind = Find.FindNextFile();

		m_sDateiName = Find.GetFileName();

		myFile.Open(m_sDateiName, CFile::modeReadWrite, &amp;fileException);

		int i = myFile.GetLength();

		myFile.Read(szPuffer, sizeof (szPuffer));

		m_sInhalt = szPuffer;
		m_sTempInhalt = szPuffer;

		UpdateData(FALSE);
	}
}
</code></pre>
<p>Mein Problem:<br />
Ich möchte meinen CString m_sInhalt nicht 500Byte gross haben, sondern nur i bytes.</p>
<p>Meine Löung wäre i merken, und im CString ein delete von 500 - i.<br />
Ist ein bisschen umständlich, geht das nicht einfacher?</p>
<p>Gruss Sven</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1065396</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1065396</guid><dc:creator><![CDATA[a.s.t_2003]]></dc:creator><pubDate>Fri, 26 May 2006 11:36:19 GMT</pubDate></item><item><title><![CDATA[Reply to Datei einlesen. on Fri, 26 May 2006 11:50:42 GMT]]></title><description><![CDATA[<p>Du könntest für szPuffer einen CString verwenden und dann</p>
<pre><code class="language-cpp">myFile.Read( szPuffer.GetBufferSetlength( i ), i );
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1065410</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1065410</guid><dc:creator><![CDATA[connan]]></dc:creator><pubDate>Fri, 26 May 2006 11:50:42 GMT</pubDate></item><item><title><![CDATA[Reply to Datei einlesen. on Fri, 26 May 2006 11:57:54 GMT]]></title><description><![CDATA[<p>Danke geht!</p>
<p>Gruss Sven</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1065423</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1065423</guid><dc:creator><![CDATA[a.s.t_2003]]></dc:creator><pubDate>Fri, 26 May 2006 11:57:54 GMT</pubDate></item></channel></rss>