daemonna
28th June 2010, 05:10
as found in examples
QSharedMemory sharedMemory("foobar");
sharedMemory.create(1024);
sharedMemory.lock();
char *to = (char*)sharedMemory.data();
char *text = "hello world";
memcpy(to, text, strlen(text)+1);
sharedMemory.unlock();
as far i understand, this will copy char/string 'hello world' into shared memory... what if i want shared memory to hold qint64? i guess i know how to read
if(!numofallplayers.attach(QSharedMemory::ReadWrit e)){
//some error
}
numofallplayers.lock();
allplayercount = (qint64)(numofallplayers.data());
numofallplayers.unlock();
but how i'm gonna write qint64 to it????
QSharedMemory sharedMemory("foobar");
sharedMemory.create(1024);
sharedMemory.lock();
char *to = (char*)sharedMemory.data();
char *text = "hello world";
memcpy(to, text, strlen(text)+1);
sharedMemory.unlock();
as far i understand, this will copy char/string 'hello world' into shared memory... what if i want shared memory to hold qint64? i guess i know how to read
if(!numofallplayers.attach(QSharedMemory::ReadWrit e)){
//some error
}
numofallplayers.lock();
allplayercount = (qint64)(numofallplayers.data());
numofallplayers.unlock();
but how i'm gonna write qint64 to it????