Click here to Skip to main content
15,920,383 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: GetBuffer?? ReleaseBuffer?? Pin
David Crow1-Jul-03 3:48
David Crow1-Jul-03 3:48 
GeneralRe: GetBuffer?? ReleaseBuffer?? Pin
skinnyreptile1-Jul-03 4:28
skinnyreptile1-Jul-03 4:28 
GeneralRe: GetBuffer?? ReleaseBuffer?? Pin
David Crow1-Jul-03 6:03
David Crow1-Jul-03 6:03 
AnswerRe: GetBuffer?? ReleaseBuffer?? Pin
Ryan Binns1-Jul-03 5:13
Ryan Binns1-Jul-03 5:13 
GeneralRe: GetBuffer?? ReleaseBuffer?? Pin
skinnyreptile1-Jul-03 5:34
skinnyreptile1-Jul-03 5:34 
AnswerRe: GetBuffer?? ReleaseBuffer?? Pin
Joan M1-Jul-03 5:44
professionalJoan M1-Jul-03 5:44 
GeneralRe: GetBuffer?? ReleaseBuffer?? Pin
skinnyreptile1-Jul-03 5:51
skinnyreptile1-Jul-03 5:51 
AnswerRe: GetBuffer?? ReleaseBuffer?? Pin
Kelly Herald1-Jul-03 6:43
Kelly Herald1-Jul-03 6:43 
The function LineLength will return the ONLY the number of characters for the given line not including the carriage-return character. According MSDN the function LineLength actually calls the message EM_LINELENGTH and in the MSDN this message states that It does not include the carriage-return character at the end of the line. Also you should account for the NULL character at the end of the string when assigning the length of the buffer.

This code works for me:
<code>	
int i, nLineLength, nLineCount;
CString strText;

nLineCount = m_redit.GetLineCount();

for (i=0;i < nLineCount ;i++)
{
     nLineLength = m_redit.LineLength(i); 
     //Add 2 to account for the CR and NULL character.
     int nActualCharactersReturned = m_redit.GetLine(i, strText.GetBuffer(nLineLength + 2)); 
     //Release the buffer with the actual # characters returned.
     strText.ReleaseBuffer(nActualCharactersReturned);
     TRACE (strText);
} 
</code>



Kelly Herald
Software Developer
MPC
GeneralRe: GetBuffer?? ReleaseBuffer?? Pin
skinnyreptile1-Jul-03 6:45
skinnyreptile1-Jul-03 6:45 
General?? displaying data Pin
shirleyLo1-Jul-03 3:09
shirleyLo1-Jul-03 3:09 
GeneralRe: ?? displaying data Pin
Joan M1-Jul-03 5:49
professionalJoan M1-Jul-03 5:49 
GeneralRe: Window styles Pin
Ravi Bhavnani1-Jul-03 3:15
professionalRavi Bhavnani1-Jul-03 3:15 
GeneralAllocating memory for a multidimensionnal array Pin
Jerome Conus1-Jul-03 1:54
Jerome Conus1-Jul-03 1:54 
GeneralRe: Allocating memory for a multidimensionnal array Pin
Ryan Binns1-Jul-03 2:10
Ryan Binns1-Jul-03 2:10 
GeneralRe: Allocating memory for a multidimensionnal array Pin
Jerome Conus1-Jul-03 2:12
Jerome Conus1-Jul-03 2:12 
GeneralRe: Allocating memory for a multidimensionnal array Pin
Ryan Binns1-Jul-03 2:24
Ryan Binns1-Jul-03 2:24 
General.doc to .txt Pin
martin_j1-Jul-03 1:54
martin_j1-Jul-03 1:54 
GeneralRe: .doc to .txt Pin
David Crow1-Jul-03 3:20
David Crow1-Jul-03 3:20 
GeneralRe: .doc to .txt Pin
martin_j1-Jul-03 3:43
martin_j1-Jul-03 3:43 
GeneralAbout PINT Pin
FlyingDancer1-Jul-03 1:51
FlyingDancer1-Jul-03 1:51 
GeneralRe: About PINT Pin
David Crow1-Jul-03 3:21
David Crow1-Jul-03 3:21 
GeneralRe: About PINT Pin
basementman1-Jul-03 4:57
basementman1-Jul-03 4:57 
GeneralRe: About PINT Pin
FlyingDancer1-Jul-03 15:16
FlyingDancer1-Jul-03 15:16 
Generalconvert SYSTEMTIME to string Pin
YaronNir1-Jul-03 1:45
YaronNir1-Jul-03 1:45 
GeneralRe: convert SYSTEMTIME to string Pin
Michael P Butler1-Jul-03 1:51
Michael P Butler1-Jul-03 1:51 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.