Delen via


CArchive::operator >>

Loads the indicated object or primitive type from the archive.

friend CArchive& operator >>( 
   CArchive& ar, 
   CObject *& pOb  
); 
throw( 
   CArchiveException*, 
   CFileException*, 
   CMemoryException*  
); 
friend CArchive& operator >>( 
   CArchive& ar, 
   const CObject *& pOb  
); 
throw( 
   CArchiveException*, 
   CFileException*, 
   CMemoryException*  
); 
CArchive& AFXAPI operator >>( 
   CArchive& ar, 
   const RECT& rect 
); 
CArchive& AFXAPI operator >>( 
   CArchive& ar, 
   POINT point 
); 
CArchive& AFXAPI operator >>( 
  CArchive& ar, 
   SIZE size 
); 
template<  
   typename BaseType,  
   class StringTraits  
> 
CArchive& operator>>( 
   ATL::CStringT< 
      BaseType,  
      StringTraits 
   >& str 
); 
CArchive& operator >>( 
   BYTE& by  
); 
CArchive& operator >>( 
   WORD& w  
); 
CArchive& operator >>( 
   int& i  
); 
CArchive& operator >>( 
   LONG& l  
); 
CArchive& operator >>( 
   DWORD& dw  
); 
CArchive& operator >>( 
   float& f  
); 
CArchive& operator >>( 
   double& d  
); 
CArchive& operator >>( 
   short& w  
); 
CArchive& operator >>( 
   char& ch  
); 
CArchive& operator>>( 
   wchar_t& ch); 
CArchive& operator >>( 
   unsigned& u  
); 
CArchive& operator >>( 
   bool& b  
); 
CArchive& operator >>( 
   ULONGLONG& dwdw  
); 
CArchive& operator >>( 
   LONGLONG& dwdw  
);

Return Value

A CArchive reference that enables multiple extraction operators on a single line.

Remarks

The last two versions above are specifically for loading 64-bit integers.

If you used the IMPLEMENT_SERIAL macro in your class implementation, then the extraction operators overloaded for CObject call the protected ReadObject function (with a nonzero run-time class pointer). This function, in turn, calls the Serialize function of the class.

The CStringT extraction operator (>>) supports loading from an archive.

Example

This example demonstrates the use of the CArchive extraction operator >> with the int type.

long l;
int i;
if(ar.IsLoading())
   ar >> l >> i;

This example demonstrates the use of the CArchive insertion and extraction operators << and >> with the CStringT type.

CString s;
if (ar.IsLoading())
   ar >> s;

Requirements

Header: afx.h

See Also

Reference

CArchive Class

Hierarchy Chart

CArchive::ReadObject

CObject::Serialize