<?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[eVC++: Probleme mit CEdit::GetLine]]></title><description><![CDATA[<p>Hallo,<br />
ich versuche gerade den Inhalt eines Editfeldes in eine String Variable zu speichern. Mein Editfeld ist nun schon vom Typ CEdit, aber mit der Funktiojn GetLine habe ich so meine Probleme. Die Hilfe schreibt folgendes:</p>
<p>int GetLine(<br />
int nIndex,<br />
LPTSTR lpszBuffer )<br />
const;</p>
<p>int GetLine(<br />
int nIndex,<br />
LPTSTR lpszBuffer,<br />
int nMaxLength )<br />
const;</p>
<p>Parameters<br />
nIndex<br />
Specifies the line number to retrieve from a multiple-line edit control. Line numbers are zero-based; a value of zero specifies the first line. This parameter is ignored by a single-line edit control.<br />
lpszBuffer<br />
Points to the buffer that receives a copy of the line. The first word of the buffer must specify the maximum number of bytes that can be copied to the buffer.<br />
nMaxLength<br />
Specifies the maximum number of bytes that can be copied to the buffer. GetLine places this value in the first word of lpszBuffer before making the call to Windows CE.</p>
<p>Da ich nur eine Zeile auslesen will, haben ich es mal so versucht:</p>
<p>m_Edit2.GetLine(0,buf,256);</p>
<p>Geht natürlich nicht, vor allem wegen des buffers, ich weis nicht genau wie ich damit umgehen soll. Als Beispiel steht in der Hilfe:</p>
<p>int i, nLineCount = pmyEdit-&gt;GetLineCount();<br />
CString strText, strLine;</p>
<p>// Dump every line of text in the edit control.<br />
for (i=0;i &lt; nLineCount;i++)<br />
{<br />
pmyEdit-&gt;GetLine(i, strText.GetBuffer(pmyEdit-&gt;LineLength(i)));<br />
strText.ReleaseBuffer();</p>
<p>strLine.Format(TEXT(&quot;line %d: '%s'\r\n&quot;), i, strText.GetBuffer(0));<br />
afxDump &lt;&lt; strLine;<br />
}</p>
<p>Leider verstehe ich auch den Code kaum. Kann mir jemand von euch auf die Sprünge helfen?<br />
MfG<br />
Basti</p>
]]></description><link>https://www.c-plusplus.net/forum/topic/194239/evc-probleme-mit-cedit-getline</link><generator>RSS for Node</generator><lastBuildDate>Fri, 10 Apr 2026 03:01:22 GMT</lastBuildDate><atom:link href="https://www.c-plusplus.net/forum/topic/194239.rss" rel="self" type="application/rss+xml"/><pubDate>Thu, 04 Oct 2007 13:26:48 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to eVC++: Probleme mit CEdit::GetLine on Thu, 04 Oct 2007 13:26:48 GMT]]></title><description><![CDATA[<p>Hallo,<br />
ich versuche gerade den Inhalt eines Editfeldes in eine String Variable zu speichern. Mein Editfeld ist nun schon vom Typ CEdit, aber mit der Funktiojn GetLine habe ich so meine Probleme. Die Hilfe schreibt folgendes:</p>
<p>int GetLine(<br />
int nIndex,<br />
LPTSTR lpszBuffer )<br />
const;</p>
<p>int GetLine(<br />
int nIndex,<br />
LPTSTR lpszBuffer,<br />
int nMaxLength )<br />
const;</p>
<p>Parameters<br />
nIndex<br />
Specifies the line number to retrieve from a multiple-line edit control. Line numbers are zero-based; a value of zero specifies the first line. This parameter is ignored by a single-line edit control.<br />
lpszBuffer<br />
Points to the buffer that receives a copy of the line. The first word of the buffer must specify the maximum number of bytes that can be copied to the buffer.<br />
nMaxLength<br />
Specifies the maximum number of bytes that can be copied to the buffer. GetLine places this value in the first word of lpszBuffer before making the call to Windows CE.</p>
<p>Da ich nur eine Zeile auslesen will, haben ich es mal so versucht:</p>
<p>m_Edit2.GetLine(0,buf,256);</p>
<p>Geht natürlich nicht, vor allem wegen des buffers, ich weis nicht genau wie ich damit umgehen soll. Als Beispiel steht in der Hilfe:</p>
<p>int i, nLineCount = pmyEdit-&gt;GetLineCount();<br />
CString strText, strLine;</p>
<p>// Dump every line of text in the edit control.<br />
for (i=0;i &lt; nLineCount;i++)<br />
{<br />
pmyEdit-&gt;GetLine(i, strText.GetBuffer(pmyEdit-&gt;LineLength(i)));<br />
strText.ReleaseBuffer();</p>
<p>strLine.Format(TEXT(&quot;line %d: '%s'\r\n&quot;), i, strText.GetBuffer(0));<br />
afxDump &lt;&lt; strLine;<br />
}</p>
<p>Leider verstehe ich auch den Code kaum. Kann mir jemand von euch auf die Sprünge helfen?<br />
MfG<br />
Basti</p>
]]></description><link>https://www.c-plusplus.net/forum/post/1377894</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1377894</guid><dc:creator><![CDATA[sebastian87]]></dc:creator><pubDate>Thu, 04 Oct 2007 13:26:48 GMT</pubDate></item><item><title><![CDATA[Reply to eVC++: Probleme mit CEdit::GetLine on Thu, 04 Oct 2007 13:49:08 GMT]]></title><description><![CDATA[<p>Die zweite Methode ist weitaus einfacher. Wenn Du die erste Variante verwendest musst Du die Größe selber setzen.<br />
Also Dir einen Buffer holen und dann einfach CString::GetBuffer/Release verwenden, oder CStrBuf.</p>
<p>Also:</p>
<pre><code class="language-cpp">CString str;
pmyEdit-&gt;GetLine(i,str.GetBuffer(256),256);
str.ReleaseBuffer();
</code></pre>
<p>Oder eben:</p>
<pre><code class="language-cpp">CString str;
pmyEdit-&gt;GetLine(i,CStrBuf(str,256),256);
</code></pre>
]]></description><link>https://www.c-plusplus.net/forum/post/1377913</link><guid isPermaLink="true">https://www.c-plusplus.net/forum/post/1377913</guid><dc:creator><![CDATA[Martin Richter]]></dc:creator><pubDate>Thu, 04 Oct 2007 13:49:08 GMT</pubDate></item></channel></rss>