D_code_writer wrote:I wrote this as pseudo code to try and save time.
It's not helpful if you post code that is not the actual code that is causing the problem.
I can see one other BIG problem:
You're setting s_physics to point to the memory of the file map, but then you're closing the file mapping!
The problem is the same with the write function. You're writing to the memory, but then you're closing the file mapping! The read function cannot read from a file mapping that doesn't exist.
I think this is the main reason it's not working. You need to copy the memory pointed to by mapFileBuffer, and return that as your result. Then you'll need to free this memory somewhere else.
So, in pseudo code:
Create File Map;
Allocate new memory = sizeof(PhysicsStruct);
Copy memory from File Map to new memory;
Set s_physics = new memory;
The difficult we do right away...
...the impossible takes slightly longer.
modified 3-Aug-18 8:48am.