инкапсулировать отображаемые в память файлы – C++ (general) – Файлы – База кода


Название (оригинал): encapsulate Memory Mapped Files

Англ (оригинал)Memory mapping is a powerful mechanism Win32 provides to implement shared memory and also to access files though a simple memory pointer without having to implement your own home brewed buffering mechanisms. As an example its as simple as calling
void* lpData = mmf.Open();
CharUpperBuff((char*) lpData, mmf.GetLength());
to convert a file (of any length) to upper case.
Areas where you might find this of interest include very large database files with fixed records, audio processing, string operations and image processing.
The other side of memory mapped files is to implement shared memory. As you will probably know, Win32 puts each process into its own address space, thus making it impossible to pass ordinary pointers across process boundaries. With memory mapped files you get back this very useful mechanism.
The enclosed zip file contains the CMemMapFile source code and a simple dialog based application which demonstrates all the functionality of the class. For further details about the example program have a look at the BOOL CTestmemmapApp::InitInstance() function and the CDialog1 member functions both in testmemmap.cpp PJ Naughter at http://indigo.ie/~pjn/index.html
Рус (машинный)Отображение памяти-это мощный механизм Win32 предоставляет для реализации разделяемой памяти, а также для доступа к файлам, хотя простой указатель памяти без необходимости реализовать собственные дома варят механизмы буферизации. В качестве примера ее простым вызовом
пустоту* lpData = ммф.Открыть()

база кода