Hi everybody,
I need to share a struct of array between process using shared memory. How can I do it?
es. of struct array I need to share:
please help me posting an example.Code:struct blabla { char ch; int i; float fl; } bla[16]
Thanks.
Hi everybody,
I need to share a struct of array between process using shared memory. How can I do it?
es. of struct array I need to share:
please help me posting an example.Code:struct blabla { char ch; int i; float fl; } bla[16]
Thanks.
What the lack of response as of yet means to say is: please describe the operating system that you are using.
The O.S. I use is Unix.
I'm able to create shared memory segment using shmget and shmat and I can share a single struct between processes. My trouble is: how to share an array af structs.
Thanks.
There are several ways. I would probably just declare a pointer to struct blabla, and set the size of the shared memory to be 16 * sizeof(struct blabla). Then use the pointer as if it was an array.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
Thank you matsp,
could you please post a little example, because I am very confused on how to use pointers to an array of struct.
Many thanks.
> because I am very confused on how to use pointers to an array of struct.
Back to the books :-)
Thanks a lot guys for the help. Now I understood.