<?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[Probleme mit GetLine() in CRichedit]]></title><description><![CDATA[<p>Hi!</p>
<p>Ich verwende die Methode GetLine() um meinen Text zeilenweise in einen Buffer zu speichern:</p>
<pre><code class="language-cpp">///
	int i, nLineLength, nLineCount = m_FehlerWarnungAusgabe.GetLineCount();
	CString strText, strLine;

	for (i=0;i &lt; nLineCount;i++)
        {
           nLineLength = m_FehlerWarnungAusgabe.LineLength(i);
           m_FehlerWarnungAusgabe.GetLine(i, strText.GetBuffer(nLineLength));
           strText.ReleaseBuffer(nLineLength);

           strLine.Format(TEXT(&quot;line %d: '%s'\r\n&quot;), i, strText.GetBuffer(0));
           afxDump &lt;&lt; strLine;
	}
	///
</code></pre>
<p>m_FehlerWarnungAusgabe ist ein Objekt meines CRicheditfensters. Das Problem ist, dass der Text in strText nicht richtig gespeichert wird. In der Variable befinden sich nur so komische Rechtecke.</p>
<p>Kann mir da jemand helfen pls?</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/173354/probleme-mit-getline-in-crichedit</link><generator>RSS for Node</generator><lastBuildDate>Sat, 25 Apr 2026 20:52:44 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/173354.rss" rel="self" type="application/rss+xml"/><pubDate>Wed, 14 Feb 2007 13:44:57 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Probleme mit GetLine() in CRichedit on Wed, 14 Feb 2007 13:44:57 GMT]]></title><description><![CDATA[<p>Hi!</p>
<p>Ich verwende die Methode GetLine() um meinen Text zeilenweise in einen Buffer zu speichern:</p>
<pre><code class="language-cpp">///
	int i, nLineLength, nLineCount = m_FehlerWarnungAusgabe.GetLineCount();
	CString strText, strLine;

	for (i=0;i &lt; nLineCount;i++)
        {
           nLineLength = m_FehlerWarnungAusgabe.LineLength(i);
           m_FehlerWarnungAusgabe.GetLine(i, strText.GetBuffer(nLineLength));
           strText.ReleaseBuffer(nLineLength);

           strLine.Format(TEXT(&quot;line %d: '%s'\r\n&quot;), i, strText.GetBuffer(0));
           afxDump &lt;&lt; strLine;
	}
	///
</code></pre>
<p>m_FehlerWarnungAusgabe ist ein Objekt meines CRicheditfensters. Das Problem ist, dass der Text in strText nicht richtig gespeichert wird. In der Variable befinden sich nur so komische Rechtecke.</p>
<p>Kann mir da jemand helfen pls?</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1228764</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1228764</guid><dc:creator><![CDATA[enne87]]></dc:creator><pubDate>Wed, 14 Feb 2007 13:44:57 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit GetLine() in CRichedit on Thu, 15 Feb 2007 08:32:24 GMT]]></title><description><![CDATA[<p>Es ist zeitweilig extrem effizient die Dokumentation zu lesen!<br />
Zitat:<br />
<em>lpszBuffer<br />
Points to the buffer to receive the text. <strong>The first word of the buffer</strong> must specify the maximum number of bytes that can be copied into the buffer.</em></p>
<pre><code class="language-cpp">///
	int i, nLineLength, nLineCount = m_FehlerWarnungAusgabe.GetLineCount();
	CString strText, strLine;

	for (i=0;i &lt; nLineCount;i++)
        {
           nLineLength = m_FehlerWarnungAusgabe.LineLength(i);
           TCHAR *buffer = strText.GetBuffer(min(sizeof(WORD),nLineLength));
           *reinterpret_cast&lt;WORD*&gt;(buffer) = nLineLength;
           m_FehlerWarnungAusgabe.GetLine(i, buffer);
           strText.ReleaseBuffer();

           strLine.Format(TEXT(&quot;line %d: '%s'\r\n&quot;), i, buffer);
           afxDump &lt;&lt; strLine;
	}
	///
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1229210</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1229210</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Thu, 15 Feb 2007 08:32:24 GMT</pubDate></item><item><title><![CDATA[Reply to Probleme mit GetLine() in CRichedit on Thu, 15 Feb 2007 08:50:50 GMT]]></title><description><![CDATA[<p>Wenn man weiter liest, kommt da noch:</p>
<blockquote>
<p><em>nMaxLength</em></p>
<p>Maximum number of characters that can be copied into lpszBuffer. The second form of <em>GetLine</em> places this value into the first word of the buffer specified by lpszBuffer.</p>
</blockquote>
<p>Damit wird die Funktion zu:</p>
<pre><code class="language-cpp">///
    int i, nLineLength, nLineCount = m_FehlerWarnungAusgabe.GetLineCount();
    CString strText, strLine;

    for (i=0;i &lt; nLineCount;i++)
        {
           nLineLength = m_FehlerWarnungAusgabe.LineLength(i);
           m_FehlerWarnungAusgabe.GetLine(i, strText.GetBuffer(nLineLength),/**/nLineLength);
           strText.ReleaseBuffer(nLineLength);

           strLine.Format(TEXT(&quot;line %d: '%s'\r\n&quot;), i, strText.GetBuffer(0));
           afxDump &lt;&lt; strLine;
    }
    ///
</code></pre>
<p><a class="plugin-mentions-user plugin-mentions-a" href="https://www.c-plusplus.net/forum/uid/35992">@Martin</a>:</p>
<blockquote>
<p>The copied line does not contain a terminating null character.</p>
</blockquote>
<p>-&gt; das heißt, du mußt entweder das \0 manuell noch anhängen oder die Größe direkt an ReleasBuffer() übergeben.</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1229230</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1229230</guid><dc:creator><![CDATA[CStoll]]></dc:creator><pubDate>Thu, 15 Feb 2007 08:50:50 GMT</pubDate></item></channel></rss>