I like to keep as much as possible in RAM for fast read/write operations... my two suggestions: Option 1 you could create a RAM Drive, then just save to a file. The two program share the data by accessing the same file in turn. Option 2 You could also create a third program (that is started before the first program, and ends after the 2nd program) that sets up a shared file with CreateFileMapping():
char \* pMyFilePointer = NULL;
HANDLE hMyFileHandle = CreateFileMapping((HANDLE)-1,
NULL,
PAGE\_READWRITE,
0,
10,
"MySharedFile");
if (hMyFileHandle != NULL)
{
pMyFilePointer = (char \*) MapViewOfFile(hMyFileHandle, FILE\_MAP\_WRITE, 0, 0, 10);
if (pMyFilePointer != NULL)
{
printf("file mapped to %p",pMyFilePointer);
\*(pMyFilePointer+0) = (unsigned char)0;
\*(pMyFilePointer+1) = (unsigned char)0xbb;
Then, your other two programs open the file with:
HANDLE hMyFileHandle;
char * pMyFilePointer;
//open data share file
hMyFileHandle = OpenFileMapping(FILE\_MAP\_WRITE, TRUE, "MySharedFile");
if (hMyFileHandle != NULL)
{
pMyFilePointer = (char \*) MapViewOfFile(hMyFileHandle,FILE\_MAP\_WRITE, 0, 0, 10);
//example write operation
\*pMyFilePointer = (unsigned char)0xAA;
}