Willy
2012-05-14 15:17:36 UTC
Hi,
I've a problem with shared memory and pointers.
I've a struct like this in shm:
typedef struct my_struct
{
char mat[3][10];
char * p_mat;
}my_struct;
and a process A that sets:
shm->p_mat = &shm->mat[2];
Another process B that try to print it:
printf("%s",shm->p_mat);
I obtain a segmentation fault.
I think that is not the right way to use pointers in shared memory, but
I can't find more info.
I've a problem with shared memory and pointers.
I've a struct like this in shm:
typedef struct my_struct
{
char mat[3][10];
char * p_mat;
}my_struct;
and a process A that sets:
shm->p_mat = &shm->mat[2];
Another process B that try to print it:
printf("%s",shm->p_mat);
I obtain a segmentation fault.
I think that is not the right way to use pointers in shared memory, but
I can't find more info.
--
*Willy* - *Contatti*: http://snipurl.com/contatti
* *FAQ* di /it-alt.comp.software.mozilla/: http://www.FAQmozilla.org
* *Gratuiki* - Software Free: http://gratuiki.willygroup.org
*Willy* - *Contatti*: http://snipurl.com/contatti
* *FAQ* di /it-alt.comp.software.mozilla/: http://www.FAQmozilla.org
* *Gratuiki* - Software Free: http://gratuiki.willygroup.org