#include #include "../DataWriteDog/writeshm.h" #include "writecore.h" DataWriteShm *dataWriteShm; bool shm_load() { key_t key; int shmid; if((key=ftok(IPC_PATH,static_cast(IPC_PORT)))==-1){ return false; } if((shmid=shmget(key,sizeof (DataWriteShm),IPC_CREAT|0666))==-1){ return false; } dataWriteShm = static_cast(shmat(shmid,nullptr,0)); return true; } int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); if(shm_load()){ WriteCore *core = new WriteCore(nullptr); core->start(); }else{ fprintf(stderr,"write shm failed"); exit(1); } return a.exec(); }