|
-
May 14th, 1999, 11:38 AM
#1
show text in CView
Hi I would like to open a text file and display it's contents in a View? I can get to the stage where i get the path of the file I'd like to open then what?
Thanks in advance
-
May 16th, 1999, 12:39 PM
#2
Re: show text in CView
Get the reference help of:
Serialize();
CArchive class
try ReadString() of it and then pDC->TextOut()
or use the overloaded << and >>
In general read the related help about the above
and you will manage with this hard problem! 
-
May 17th, 1999, 07:32 AM
#3
Re: show text in CView
You should use the CEditView, not the CView.
After that,just do it as following:
CStdioFile stdfile(filename,CFile::modeRead);
CString str1="";
CString str2="\r\n";
while(stdfile.ReadString(str1))
str2+=str1+"\r\n";
YourView->GetEditCtrl()->SetWindowText(str2);
Try it,hope it works.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|