Where to use CArchive ?

Hi,
I have seen it being used with CFile.Can anyone tell me where exactly to use .an example please...
[106 byte] By [rag84dec] at [2007-11-20 8:39:40]
# 1 Re: Where to use CArchive ?
form MSDN

You can think of an archive object as a kind of binary stream. Like an input/output stream, an archive is associated with a file and permits the buffered writing and reading of data to and from storage. An input/output stream processes sequences of ASCII characters, but an archive processes binary object data in an efficient, nonredundant format.

You must create a CFile object before you can create a CArchive object. In addition, you must ensure that the archive's load/store status is compatible with the file's open mode. You are limited to one active archive per file.

When you construct a CArchive object, you attach it to an object of class CFile (or a derived class) that represents an open file. You also specify whether the archive will be used for loading or storing. A CArchive object can process not only primitive types but also objects of CObject-derived classes designed for serialization. A serializable class usually has a Serialize member function, and it usually uses the DECLARE_SERIAL and IMPLEMENT_SERIAL macros, as described under class CObject.

The overloaded extraction (>>) and insertion (<<) operators are convenient archive programming interfaces that support both primitive types and CObject-derived classes.

CArchive also supports programming with the MFC Windows Sockets classes CSocket and CSocketFile. The IsBufferEmpty member function supports that usage.

it will be suffcient
ashukasama at 2007-11-11 3:48:43 >
# 2 Re: Where to use CArchive ?
When you want to store the state of a Object that time you use CArchive . or in Simple terms in case of serialization ( storing and retrieving state of a object) you need to use CArchive

Thanx
humptydumpty at 2007-11-11 3:49:49 >