How do you share a static constant global string between two separate applications in Qt? -
i writing client , server separate applications. there global strings both should have access in order ensure proper communication between two. typical method provide such strings both applications?
i imagine 1 possible method place strings in header file , distribute file both applications. there in qt can use obtain os-agnostic location place header file both applications know it?
i'm looking solution benefits existing qt libraries, generic approach work well. i'm not sure "library" necessary, far qt has helped applications os-agnostic , don't want break paradigm.
update add clarity: these global strings static , constant - meaning wouldn't change during runtime, shared memory isn't needed. don't want have header file in client , header file in server , have make sure contents same.
edit: qsettings
should trick, too, @amartel suggested.
it persistent , access. make sure programs perform readsettings
, writesettings
when necessary, if want updated settings on fly. ini format has.
http://qt-project.org/doc/qt-4.8/mainwindows-application.html
http://qt-project.org/doc/qt-4.8/qsettings.html#details
http://qt-project.org/doc/qt-4.8/tools-settingseditor.html
qsharedmemory
work.
http://qt-project.org/doc/qt-4.8/qsharedmemory.html
example:
http://qt-project.org/doc/qt-4.8/ipc-sharedmemory.html
you can achieve qlocalserver
.
http://qt-project.org/doc/qt-4.8/qlocalserver.html
http://qt-project.org/doc/qt-4.8/qlocalsocket.html
example:
http://qt-project.org/doc/qt-4.8/ipc-localfortuneclient.html
http://qt-project.org/doc/qt-4.8/ipc-localfortuneserver.html
hope helps.
Comments
Post a Comment