Defining own main functions arguments argc and argv

前端 未结 6 2391
野性不改
野性不改 2020-12-09 15:16

i want to create an object of type QApplication which needs the main functions arguments argc and argv as an input:

QApplication app(argc, argv);
         


        
6条回答
  •  孤街浪徒
    2020-12-09 15:55

    How about...

    int argc = 2;
    const char* argv[] ={"program","first-argument"}; 
    

    ...or if you need them to be non-const...

    int argc = 2;
    char* argv[] ={strdup("program"),strdup("first-argument")}; 
    

提交回复
热议问题