1234567891011121314151617181920212223242526272829303132333435 |
- #include <QCoreApplication>
- #include "writeshm.h"
- #include "dogcore.h"
- #include <QDir>
- #include <QFile>
- DataWriteShm *dataWriteShm;
- bool load_shm(){
- int shmid;
- key_t key;
- if((key=ftok(IPC_PATH,static_cast<int>(IPC_PORT)))==-1){
- return false;
- }
- if((shmid=shmget(key,sizeof(DataWriteShm),IPC_CREAT|0666))==-1){
- return false;
- }
- dataWriteShm = static_cast<DataWriteShm *>(shmat(shmid,nullptr,0));
- return true;
- }
- int main(int argc, char *argv[])
- {
- QCoreApplication a(argc, argv);
- if(load_shm()){
- DogCore *dogcore = new DogCore(nullptr);
- dogcore->start();
- }else{
- fprintf(stderr,"load shm err");
- exit(1);
- }
- return a.exec();
- }
|