main.cpp 623 B

123456789101112131415161718192021222324252627
  1. #include <QCoreApplication>
  2. #include "dataprecess.h"
  3. #include "dogcore.h"
  4. YtDashBoardShm *dataProcessShm;
  5. bool load_shm(){
  6. int shmid;
  7. key_t key;
  8. if((key = ftok(SHM_PATH,static_cast<int>(SHM_PORT)))==-1)
  9. return false;
  10. if((shmid = shmget(key,sizeof(YtDashBoardShm),IPC_CREAT|0666))==-1)
  11. return false;
  12. dataProcessShm = static_cast<YtDashBoardShm *>(shmat(shmid,nullptr,0));
  13. return true;
  14. }
  15. int main(int argc, char *argv[])
  16. {
  17. QCoreApplication a(argc, argv);
  18. if(load_shm()){
  19. DogCore *core = new DogCore(nullptr);
  20. }else{
  21. exit(1);
  22. }
  23. return a.exec();
  24. }