#include #include // #include #include #include int main(int argc, _TCHAR* argv[]) { HANDLE src; src = CreateFile ( "C:\\work\\abc.dat", // pointer to name of the file GENERIC_READ | GENERIC_WRITE, // access (read-write) mode 0, // share mode NULL, // pointer to security attributes OPEN_ALWAYS, // how to create FILE_ATTRIBUTE_NORMAL, // file attributes NULL // handle to file with attributes to copy ); if (src != INVALID_HANDLE_VALUE) { std::cout << "Soubor otevren" << std::endl; HANDLE m; m = CreateFileMapping (src, // file handle NULL, // pointer to security attributes PAGE_READWRITE, 0, // high size 16*1024, // low size, NULL // name ); if (m != NULL) { std::cout << "Zobrazeni vytvoreno" << std::endl; void * p; p = MapViewOfFile (m, // mapping FILE_MAP_WRITE | FILE_MAP_READ, // access 0, // high offset 0, // low offest 8*1024); // size if (p != NULL) { std::cout << "Soubor zobrazen" << std::endl; UnmapViewOfFile (p); } CloseHandle (m); } CloseHandle (src); } char * str = new char [11]; std::cin.getline(str, 10); return 0; }