Ok, that works! Thanks!
If anyone can use it, here is the code:
Code:
static HANDLE hFileMap;
static char *Buff = NULL;
// Create File Mapping (use invalid handle, don't link to real file, +1 for synchronization)
hFileMap = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, 100, "memMappedFile");
if (!hFileMap)
{
perror("Unable to create file mapping,Error");
return;
}
Buff = static_cast<char*> ( MapViewOfFile(hFileMap, FILE_MAP_WRITE, 0, 0, 0) );
Buff[0] = 'H'; // uncomment for client,
Buff[1] = 'i'; // to read from buffer
cout << "Buff0 = " << Buff[0] << ", Buff1=" << Buff[1] << ".\n";
The next step is create a char array...