• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 232
  • Last Modified:

how to put text file's data into CView.

I have a char pointer - char * lpData - with holds all the char data(including LF,CR) from a text file(for some reason, i can not directly load the data from file). Now I want to put these data into CView area like those text editor open a text file.
how would I implement this ?
I don't think it is a good idea to loop through lpData and print character by character, isn't it ?
1 Solution
Vinayak KumbarSr Program ManagerCommented:
You can do that using DrawText() function.
This is the code segment for your question.
Here you can specify the rectangle value or you can fill it using GetClientRect() function also

      CFile l_file;
      char *lpData = NULL;
      CClientDC dc(this);
      int l_Length = 0;

            AfxMessageBox("not opened");
      l_Length = l_file.GetLength();

      lpData = new char[l_Length+1];

      CRect rect(10,10,400,100);
Take care to delete the character pointer.

Hope it helps you.

eugenengAuthor Commented:
thanx VinExpert, you code work fine. Actually i just need this


anyhow, thanx a lot man..
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

The 14th Annual Expert Award Winners

The results are in! Meet the top members of our 2017 Expert Awards. Congratulations to all who qualified!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now