|
Depends on what language/API you're trying to do it in. For example, to insert the text stored in the CString object newText into line 2 of a CEdit object named m_big, the code would be:
int i=m_big.LineLength(0)+2;
m_big.SetSel(i, i);
m_big.ReplaceSel(newText + "\r\n");
The +2 is there so that it includes the the \r\n sequence at the end of every line.
The SetSel function will set the current selection, but since the start and end values are the same, it merely moves the insertion point.
ReplaceSel will either replace the currently selected text or insert the text at the current insertion point if there is no current selection.
[edit]
Please don't worry about "credit" for this. As long as you learn the stuff and write your own code, you really don't need to credit people. Think of it like learning out of a book--you don't credit the author unless you copy specific portions of code directly from the book.
[/edit]
|