SCI_GETLINE(int line, char *text)
This fills the buffer defined by text with the contents of the nominated
line (lines start at 0). The buffer is not terminated by a 0 character. It
is up to you to make sure that the buffer is long enough for the text, use
SCI_LINELENGTH(int line). The returned value is the number of characters
copied to the buffer. The returned text includes any end of line characters.
If you ask for a line number outside the range of lines in the document, 0
characters are copied. If the text argument is 0 then the length that should
be allocated to store the entire line is returned.

The following modification to your code might work (untried)

   long lLen = SendMessage(SCI_LINELENGTH,line,0) ;
   if (lLen > 0)
   {
      TCHAR *p = new TCHAR[lLen+1];
      if (p != NULL)
      {
         SendMessage(SCI_GETLINE, line, (long)p); // returned string is not
NULL terminated
         p[lLen] = TCHAR(0);                            // so terminate it
         CString strReturn =p;
         delete [] p;
         return strReturn;
      }
   }




_______________________________________________
Scintilla-interest mailing list
[email protected]
http://mailman.lyra.org/mailman/listinfo/scintilla-interest

Reply via email to