Share via


CMemFile::CMemFile

The first overload opens an empty memory file.

CMemFile( 
   UINT nGrowBytes = 1024  
); 
CMemFile( 
   BYTE* lpBuffer, 
   UINT nBufferSize, 
   UINT nGrowBytes = 0  
);

Parameters

  • nGrowBytes
    The memory allocation increment in bytes.

  • lpBuffer
    Pointer to a buffer that receives information of the size nBufferSize.

  • nBufferSize
    An integer that specifies the size of the file buffer, in bytes.

Remarks

Note that the file is opened by the constructor and that you should not call CFile::Open.

The second overload acts the same as if you used the first constructor and immediately called Attach with the same parameters. See Attach for details.

Example

CMemFile f; // Ready to use - no Open necessary.

BYTE * pBuf = (BYTE *)new char [1024];
CMemFile g(pBuf, 1024, 256);
// same as CMemFile g; g.Attach(pBuf, 1024, 256);

Requirements

Header: afx.h

See Also

Reference

CMemFile Class

Hierarchy Chart

CMemFile::Attach