Fog Creek Software
g
Discussion Board




Saving contents of CRichEditCtrl in VC++

All,

Using Visual Studio C++ .net
Un-managed code (not using .net)

I have a standard Document/View app.  The majority of the page is taken up by a CRichEditCtrl.  I would like to save the contents using the seralize method provided in the Doc.  However, the msdn examples for saving the contents of a CRichEditCtrl show opening the file and providing the callback function.

This is giving me a bit of trouble as the CArchive already has the file open and reading and writing to it cause errors.

I am a bit of newbie to MFC.  I was rocking along until I hit this little snag.

Thanks in advance!

Andrew Scott
Sunday, May 2, 2004

You might try obtaining the CFile object from the CArchive object using CArchive's member function GetFile.  Then use that particular CFile object in your callback to implement the read/write to the file.

Dave B.
Sunday, May 2, 2004

Dave,

You know, I did that around 12:30pm today and I had some problems with file persmissions (?).  So I tried about five other ideas.

After reading your comment I decided to try it again and behold!  It worked!  Evidently I did something wrong.

Thanks for the comment!

Andrew

Andrew Scott
Sunday, May 2, 2004

*  Recent Topics

*  Fog Creek Home