If you want total control of the bytes placed in the shared memory segment then you can either put them into a QByteArray directly or you can use QIODevice::write() against a QBuffer.
I suggest you dump buffer.data().toHex() and inspect what QDataStream actually put into the buffer. Your generic C++ is expecting the buffer to start with a '\0' terminated string but it does not; it starts with a 4-byte length integer as described in the QDataStream docs. For a short string 3 of those 4 bytes will be '\0', terminating any string you read. The actual string component may also not have the terminating '\0' any longer.




Reply With Quote

Bookmarks