struct
struct_a{
char sym[6];char desc[8];
double price;
};
shMemList* m_pList;
m_shMemPtr.reset(
new shMemObject(boost::interprocess::open_or_create, "shmemfile.shmem" , 100000*sizeof(struct_a)));m_shMemPtr->reserve_named_objects(100000);
m_pList = m_shMemPtr->find_or_construct<shMemList>("SHMEM_NAME")(m_shMemPtr->get_segment_manager());
struct_a stOne;
strcpy(stOne.sym, "ABCDE");
strcpy(stOne.desc, "FGHIJK");
stOne.price = 10.25;
m_pList->push_back(stOne);
Another program Opens this sharedmemory file and reads the struct from the list and 'pops' it.
What happens sometimes is, In the first field of the struct I see 'SHMEM_NAME' and the program crashes when this happens. I am not sure what's causing the struct.field to comein as Sharedmemory name?
If I clean the shared memory file and restart it works fine but I end up with this problem some ther time. This does not happen regularly but it sure does.
I'd really appreciate any help figuring the solution out or if there's any mistake I am making.
Thanks in Advance,
Srinivas Gardas