[PyQt] How to read/write in QSharedMemory

TGS France Alexandre alexandre.raczynski at technogerma.fr
Wed Jul 29 09:30:24 BST 2009


Hi,

It looks like there is nothing available in PyQt to read from a 
QSharedMemory or to write into it.
How to use the sip.voidptr returned by QSharedMemory.data()?

Here is a piece of code that shows the writing problem:

/# Encode data into a buffer/
buffer = QtCore.QBuffer()
buffer.open(QtCore.QIODevice.WriteOnly)
out = QtCore.QDataStream(buffer)
out.writeInt32(1234)
size = buffer.size()

/# Create the shared memory/
sharedMemory = QtCore.QSharedMemory('key')
sharedMemory.create(size)

/# Write the encoded data into the shared memory/
sharedMemory.lock()
*memcpy(sharedMemory.data(), buffer.data().data(), size)* # How to do 
somehting like that?
sharedMemory.unlock()

Regards,
Alexandre.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: alexandre_raczynski.vcf
Type: text/x-vcard
Size: 288 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20090729/c7a13daa/alexandre_raczynski.vcf


More information about the PyQt mailing list