/* * PROGRAM TEST for exchanging a string through a shared memory */ #include #include using namespace std; namespace intp = boost::interprocess; int main ( int argc, char* argv[] ) { try { // *** CREATING THE SHARED MEMORY *** // Erase older shared memory eventually present intp::shared_memory_object::remove ( "str_mem" ); // Set the dimension of the memory int shd_bytes = 100000; // Creates the segment intp::managed_shared_memory segment (intp::create_only,"str_mem",shd_bytes); // *** EXCHANGING THE STRING *** // Create a string in the shared segment string *opts = segment.construct ("opts")("Hello world!"); // Print it cout<c_str() = \t"<c_str()<