AndyS
May 14th, 1999, 11:38 AM
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
Thanks in advance
|
Click to See Complete Forum and Search --> : show text in CView AndyS May 14th, 1999, 11:38 AM 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 ric May 16th, 1999, 12:39 PM 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! :) Playman Cheng May 17th, 1999, 07:32 AM 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. codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |