can't read from a buffer

N

nass

hello everyone
ok i have created a shared memory segment and can save data into it.. i
can check because the segment is directly connected to a file in the
disk. so yes i have verified data (bytes really) is written into the
memory. the problem is reading...
basically just like in saving i create the same exact structure:
struct manualStruct {
Q_UINT8 mC1St;
Q_UINT8 mC2St;
Q_UINT8 mC3St;
};
Q_UINT8 is just a Qt specific platform free type which is basically
unsigned int 8bits long
and then
struct manualStruct *manualVar=(manualStruct*)((char*)file_memory +
0xC5);
basically file_memory is a void* pointer to the shared memory segment,
so i cast it, add an offset to the exact location where data is written
and then i simply assingn manualVar.
next i should be able to just:
MANUAL_cap1State=manualVar->mC1St;
MANUAL_cap2State=manualVar->mC2St;
MANUAL_cap3State=manualVar->mC3St;
where MANUAL_* variables are int.
then i just test with cout to see if the values have been copies and
well they haven't...
any ideas why?
nass
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,015
Latest member
AmbrosePal

Latest Threads

Top