CMemFile is the CFile-derived class that supports in-memory files. These in-memory files behave like binary disk files except that bytes are stored in RAM. An in-memory file is a useful means of transferring raw bytes or serialized objects between independent processes.
Contiguous memory is automatically allocated in specified increments, and it is deleted when the object is destroyed. You can access this memory through a pointer supplied by a member function.
#include <afx.h>
The following CFile functions are not implemented for CMemFile:
Duplicate
LockRange
UnlockRange
If you call these functions on a CMemFile object, you will get a CNotSupportedException.
The data member CFile::m_hFile is not used and has no meaning.
If you derive a class from CMemFile, you must use the protected memory-allocation functions listed above, overriding them as necessary. If you need global memory access from the Windows medium model, for example, derive a class with the four protected functions overridden. Your replacement functions should call the Windows GlobalAlloc family of functions.