CEdit multiline Get line by line ?!? 
Author Message
 CEdit multiline Get line by line ?!?

Hi

I try to read the text of a multiline CEdit Control line by line and
write this to a specified file. So far so good but the length of the
lines makes me trouble.
When I read the first line with 10 characters and the second with only 5
characters the text displayed in my file has for each line only 5
characters.
I use a "for" loop for reading and writing. This loop takes the last
line length as the line length for each line. Is there a possibility to
do this in another way or can anybody give me a hint for correcting this
loop ?
Here is my code:
#define MAX_FILE_SIZE 10000

void CHTML_KonvertierungDlg::OnButton1()
{
 if(m_FileName.LineLength==0){
  AfxMessageBox("Please type a correct file and pathname");
  return;
 }

 CString strTemp;
 m_FileName.GetWindowText(strTemp);
 CFile tempFile(strTemp,CFile::modeCreate|CFile::modeWrite);

 char a[MAX_FILE_SIZE];

int b=m_Text.GetLineCount();
int t =m_Text.LineIndex();

for ( t=0;t<b;t++)
  {
          int nLen = m_Text.LineLength();
          m_Text.GetLine(t,a,nLen);
          a[nLen] ='\0';

         int n_Size = sizeof(nLen);
         tempFile.Write(a,nLen);

  }

 tempFile.Close();

Quote:
}



Wed, 24 Jul 2002 03:00:00 GMT  
 CEdit multiline Get line by line ?!?
Kirk,
        Try passing the line number parameter to the LineLength function, as I did in
my last post to you:
   int nLen = m_Text.LineLength( t );
   m_Text.GetLine(t,a,nLen);
   a[nLen] ='\0';


Wed, 24 Jul 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Add line to a multiline CEdit

2. Line Breaks don't work in Multiline CEdit control

3. CEdit Multiline Control, adding new lines.

4. Set text color for 1 line in a CEdit control (MultiLine)

5. multiple-line CEdit set multi-line text

6. Extracting lines of text out of a multiline string

7. line feed in Multiline edit control

8. How to chang lines in multiline edit contrl

9. How to change lines in multiline edit control?

10. Multiline Edit Control and Line Length

11. how to write lines in a CEdit control ?

12. Adding lines to a CEdit

 

 
Powered by phpBB® Forum Software