Definition of string in shared memory
Hello, I can't useful examples about how to store string in shared memory. I have to share a queue of Element objects (queue<Element> *) between processes. This is the signature of Element class : class Element { ... private : string dir; string file; ... } I used a shared_memory_object to use the queue. When I test it with thread, it is working fine. But when i test it with process, I obtained some segmentation fault because it can't retrieve the attributes for an Element object. it is normal because I am creating the Element object in one process the second can't access it. I have seen in boost documentation the template interprocess:basic_string. But I have no clue how to use it. I would like to have something like : typedef basic_string< string, segment> mystring class Element { ... private : mystring dir; mystring file; ... } Could you someone show me how to do that in the creation but also in the implementation. Thanks you in advance Regards Samuel
participants (1)
-
Samuel Gallard