Microsoft Foundation Classes (mfc.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
class CArchive
                                              Up Contents Index Back
──Microsoft Foundation Classes──────────────────────────────────────────────
 
  Description
 
  The CArchive class allows you to save a complex network of objects in a
  permanent binary form (usually disk storage) that "persists" after those
  objects are deleted. Later you can load the objects from persistent
  storage, "reconstituting" them in memory. This process of making data
  persistent is called "serialization."
 
  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.
 
  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
  must have a Serialize member function, and it must use 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.
 
  #include <afx.h>
 
  See Also
 
  CFile, CObject
 
  Preconditions
 
  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.
 
  Public Members
 
  Construction/Destruction
 
  CArchive   Creates a CArchive object.
 
  ~CArchive   Destroys a CArchive object and flushes unwritten data.
 
  Close      Flushes unwritten data and disconnects from the CFile.
 
  Basic Input/Output
 
  Flush         Flushes unwritten data from the archive buffer.
 
  operator >>   Stores objects and primitive types to the archive.
 
  operator <<   Loads objects and primitive types from the archive.
 
  Read          Reads raw bytes.
 
  Write         Writes raw bytes.
 
  Status
 
  GetFile     Gets the CFile object pointer for this archive.
 
  IsLoading   Determines if the archive is loading.
 
  IsStoring   Determines if the archive is storing.
 
  Protected Members
 
  Object Input/Output
 
  ReadObject    Calls an object's Serialize function for loading.
 
  WriteObject   Calls an object's Serialize function for storing.
 
 
                                     -♦-