Where MFC save the data temporarily?

Programming, for all ages and all languages.
Post Reply
Ghazala

Where MFC save the data temporarily?

Post by Ghazala »

In VC++ when we can easily make the text editor using Microsoft Foundation Classes (MFC). I just want to know the place where it temporarily holds the data. I want to retrieve that data so that I can perform some function on it. My custom functions (not standard text editor functions). Any one can solve my problem
Tom

Re:Where MFC save the data temporarily?

Post by Tom »

CAchive ( I think ).
adeelmahmood1

Re:Where MFC save the data temporarily?

Post by adeelmahmood1 »

well i might be wrong but can we actually RETRIEVE any data from cache ?? ???
Tom

Re:Where MFC save the data temporarily?

Post by Tom »

Cache...what does this have to do with that?
adeelmahmood1

Re:Where MFC save the data temporarily?

Post by adeelmahmood1 »

then what is this "CAchive"?
ark

Re:Where MFC save the data temporarily?

Post by ark »

The instant text editor created by AppWizard uses a CEditView, which is basically a wrapper around the API edit control. The first thing I would recommend trying is CEditView::GetWindowText(), and if that doesn't work use CEdit::GetWindowText -- you can get a CEditView object's edit control by calling CEditView::GetEditCtrl or something like that. Look up CEditView in the msdn library.
ark

Re:Where MFC save the data temporarily?

Post by ark »

I think what Tom meant to say was "CArchive", which is used for saving files and things like that. I haven't used it very much so I don't if it's used for anything else but that, but I do know that it is used for saving and loading files.

In any case, the text for an edit control (even one wrapped by CEdit or CEditView) is stored in the edit control's data area, which is managed by Windows and not MFC, and the data stored there is retrieved by a call to GetWindowText.
Tom

Re:Where MFC save the data temporarily?

Post by Tom »

You can save any data to RAM and other stuff with CArchive...I think.
Tim

Re:Where MFC save the data temporarily?

Post by Tim »

CFile is a general class for doing file I/O. There are various subclasses of CFile, such as CMemFile and CInternetFile, which get their data from somewhere other than a disk.

A CArchive object can wrap anything derived from CFile, including CMemFile etc. (which is probably what Tom was thinking of). It lets you do things like:

Code: Select all

CFile file("file.txt");
CArchive ar(&file);
ar << "Hello, world");
MFC's CDocument class uses CArchive to load and save data. If you look at the CDocument implementation for a text editor application generated by Class Wizard, you will see that the document's Serialize() method just uses the CEditView to read and write to and from the archive.
Post Reply