Click here to Skip to main content
15,908,437 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Find element at given index after a number of rotations Pin
Richard MacCutchan6-Aug-18 2:49
mveRichard MacCutchan6-Aug-18 2:49 
GeneralRe: Find element at given index after a number of rotations Pin
DRHuff10-Aug-18 6:31
DRHuff10-Aug-18 6:31 
QuestionTell me about the c programming languages Pin
Member 139375164-Aug-18 17:29
Member 139375164-Aug-18 17:29 
AnswerRe: Tell me about the c programming languages Pin
Victor Nijegorodov4-Aug-18 20:44
Victor Nijegorodov4-Aug-18 20:44 
AnswerRe: Tell me about the c programming languages Pin
jfbode10297-Aug-18 7:08
jfbode10297-Aug-18 7:08 
QuestionForward error correction in C-programming applied to non-streaming data? Pin
arnold_w4-Aug-18 19:23
arnold_w4-Aug-18 19:23 
AnswerRe: Forward error correction in C-programming applied to non-streaming data? Pin
leon de boer5-Aug-18 14:25
leon de boer5-Aug-18 14:25 
QuestionDid I Overlook Something, or is the LTCG Document Page Actually Outdated? Pin
David A. Gray4-Aug-18 11:32
David A. Gray4-Aug-18 11:32 
Questionhow to query a previous query Pin
piano00113-Aug-18 23:03
piano00113-Aug-18 23:03 
AnswerRe: how to query a previous query Pin
Victor Nijegorodov4-Aug-18 2:02
Victor Nijegorodov4-Aug-18 2:02 
QuestionCondition variable question Pin
samzcs3-Aug-18 7:31
samzcs3-Aug-18 7:31 
AnswerRe: Condition variable question Pin
Richard MacCutchan3-Aug-18 21:09
mveRichard MacCutchan3-Aug-18 21:09 
GeneralRe: Condition variable question Pin
focusdoit4-Aug-18 2:39
focusdoit4-Aug-18 2:39 
GeneralRe: Condition variable question Pin
Richard MacCutchan4-Aug-18 3:19
mveRichard MacCutchan4-Aug-18 3:19 
GeneralRe: Condition variable question Pin
focusdoit4-Aug-18 3:22
focusdoit4-Aug-18 3:22 
GeneralRe: Condition variable question Pin
Richard MacCutchan4-Aug-18 3:31
mveRichard MacCutchan4-Aug-18 3:31 
GeneralRe: Condition variable question Pin
focusdoit4-Aug-18 8:25
focusdoit4-Aug-18 8:25 
GeneralRe: Condition variable question Pin
Richard MacCutchan4-Aug-18 9:32
mveRichard MacCutchan4-Aug-18 9:32 
GeneralRe: Condition variable question Pin
focusdoit4-Aug-18 16:30
focusdoit4-Aug-18 16:30 
GeneralRe: Condition variable question Pin
Richard MacCutchan4-Aug-18 20:57
mveRichard MacCutchan4-Aug-18 20:57 
QuestionA Problem in Writing Shared Memory to windows from a C++ application Pin
D_code_writer2-Aug-18 5:00
D_code_writer2-Aug-18 5:00 
AnswerRe: A Problem in Writing Shared Memory to windows from a C++ application Pin
Richard Andrew x642-Aug-18 13:00
professionalRichard Andrew x642-Aug-18 13:00 
AnswerRe: A Problem in Writing Shared Memory to windows from a C++ application Pin
Richard Andrew x642-Aug-18 13:06
professionalRichard Andrew x642-Aug-18 13:06 
GeneralRe: A Problem in Writing Shared Memory to windows from a C++ application Pin
D_code_writer2-Aug-18 20:24
D_code_writer2-Aug-18 20:24 
GeneralRe: A Problem in Writing Shared Memory to windows from a C++ application Pin
Richard Andrew x643-Aug-18 2:41
professionalRichard Andrew x643-Aug-18 2: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.

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.