I want to send data from a python script to a c++ application via file mapping. However, my c++ application does not find the python file.
Here is my code:
Python:
with mmap.mmap(-1, 4048, tagname="test", access=mmap.ACCESS_WRITE) as mm:
mm.write(b"Hello world!")
and the c++ code:
TCHAR szName[] = TEXT("test");
HANDLE hMapFile;
LPCTSTR pBuf;
hMapFile = OpenFileMapping(
FILE_MAP_READ, // read/write access
FALSE, // do not inherit the name
szName); // name of mapping object
if (hMapFile == NULL)
{
DWORD test = GetLastError();
_tprintf(TEXT("Could not open file mapping object (%d).\n"),
GetLastError());
}
here I am receiving the Error "ERROR_FILE_NOT_FOUND".
Any ideas what I am doing wrong?
Thanks a lot for any answer!