Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


how to put text file's data into CView.

Posted on 1999-07-20
Medium Priority
Last Modified: 2013-11-20
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 ?
Question by:eugeneng
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

VinExpert earned 80 total points
ID: 1310542
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.


Author Comment

ID: 1310543
thanx VinExpert, you code work fine. Actually i just need this


anyhow, thanx a lot man..

Featured Post

Survive A High-Traffic Event with Percona

Your application or website rely on your database to deliver information about products and services to your customers. You can’t afford to have your database lose performance, lose availability or become unresponsive – even for just a few minutes.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this post we will learn different types of Android Layout and some basics of an Android App.
Ready to get certified? Check out some courses that help you prepare for third-party exams.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

715 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question