Click here to Skip to main content
15,844,155 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Condition variable question Pin
Richard MacCutchan4-Aug-18 10:32
mveRichard MacCutchan4-Aug-18 10:32 
GeneralRe: Condition variable question Pin
focusdoit4-Aug-18 17:30
focusdoit4-Aug-18 17:30 
GeneralRe: Condition variable question Pin
Richard MacCutchan4-Aug-18 21:57
mveRichard MacCutchan4-Aug-18 21:57 
QuestionA Problem in Writing Shared Memory to windows from a C++ application Pin
D_code_writer2-Aug-18 6:00
D_code_writer2-Aug-18 6:00 
AnswerRe: A Problem in Writing Shared Memory to windows from a C++ application Pin
Richard Andrew x642-Aug-18 14:00
professionalRichard Andrew x642-Aug-18 14:00 
AnswerRe: A Problem in Writing Shared Memory to windows from a C++ application Pin
Richard Andrew x642-Aug-18 14:06
professionalRichard Andrew x642-Aug-18 14:06 
GeneralRe: A Problem in Writing Shared Memory to windows from a C++ application Pin
D_code_writer2-Aug-18 21:24
D_code_writer2-Aug-18 21:24 
GeneralRe: A Problem in Writing Shared Memory to windows from a C++ application Pin
Richard Andrew x643-Aug-18 3:41
professionalRichard Andrew x643-Aug-18 3:41 
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!

EDIT:
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:

Read Function:
Create File Map;
Allocate new memory = sizeof(PhysicsStruct);
Copy memory from File Map to new memory;
Set s_physics = new memory;
return s_physics;



The difficult we do right away...
...the impossible takes slightly longer.


modified 3-Aug-18 8:48am.

GeneralRe: A Problem in Writing Shared Memory to windows from a C++ application Pin
D_code_writer3-Aug-18 13:45
D_code_writer3-Aug-18 13:45 
GeneralRe: A Problem in Writing Shared Memory to windows from a C++ application Pin
Richard Andrew x643-Aug-18 14:44
professionalRichard Andrew x643-Aug-18 14:44 
GeneralRe: A Problem in Writing Shared Memory to windows from a C++ application Pin
D_code_writer3-Aug-18 15:05
D_code_writer3-Aug-18 15:05 
QuestionCEditCtrl in FrameWnd Pin
john56322-Aug-18 0:50
john56322-Aug-18 0:50 
AnswerRe: CEditCtrl in FrameWnd Pin
Richard MacCutchan2-Aug-18 1:35
mveRichard MacCutchan2-Aug-18 1:35 
AnswerRe: CEditCtrl in FrameWnd Pin
Jochen Arndt2-Aug-18 1:51
professionalJochen Arndt2-Aug-18 1:51 
AnswerRe: CEditCtrl in FrameWnd Pin
Victor Nijegorodov2-Aug-18 2:01
Victor Nijegorodov2-Aug-18 2:01 
QuestionRun CFile::Open as admin Pin
_Flaviu1-Aug-18 22:47
_Flaviu1-Aug-18 22:47 
AnswerRe: Run CFile::Open as admin Pin
Jochen Arndt1-Aug-18 23:54
professionalJochen Arndt1-Aug-18 23:54 
GeneralRe: Run CFile::Open as admin Pin
_Flaviu2-Aug-18 0:00
_Flaviu2-Aug-18 0:00 
Questionexecl in c++ example Pin
Shaul.amir30-Jul-18 23:12
Shaul.amir30-Jul-18 23:12 
AnswerRe: execl in c++ example Pin
Jochen Arndt31-Jul-18 0:02
professionalJochen Arndt31-Jul-18 0:02 
Questionhelp me~ for use..... #define macro ## #@ # Pin
dsyoon ds29-Jul-18 18:00
dsyoon ds29-Jul-18 18:00 
AnswerRe: help me~ for use..... #define macro ## #@ # Pin
Daniel Pfeffer29-Jul-18 21:45
professionalDaniel Pfeffer29-Jul-18 21:45 
QuestionThe new upgrade system Pin
Anthony Appleyard28-Jul-18 13:50
Anthony Appleyard28-Jul-18 13:50 
AnswerRe: The new upgrade system Pin
Anthony Appleyard28-Jul-18 19:35
Anthony Appleyard28-Jul-18 19:35 
GeneralRe: The new upgrade system Pin
Richard MacCutchan28-Jul-18 23:20
mveRichard MacCutchan28-Jul-18 23:20 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.