Accessing a Specific Text Line Inside CEditView :: MFC
I have a program running under doc/view single doc architecture. When the user opens a text file, the program displays the data from the text file in its original form. Special thanks to Tychom for the key technique.
When the program first opens the file, it saves data into a CStringList. However, if the user make changes to one or more lines of text, I have not been able to access the updated text.
I can get the updated text using GetWindowText(), but that function only returns a specific line parallel to the cursor. What if the user add one or more new lines? I have no way to accessing a specific line.
There is a function in CEdit, getline(). The first parameter is the line index. The second is a reference to LPTSTR. I tried to use that function to get a specific line, but the program crashed with an error "bad pointer."
CEditCtrl::getline(1, text); // this program crashes here every time
Is there a way to access a specific line inside CEditView not dependent on where the cursor location?