1. 程式人生 > >ORBSLAM2原始碼學習之1-argv and argc

ORBSLAM2原始碼學習之1-argv and argc

針對與slam 讀取資料時的函式時argc[ ]

LoadImages(string(argv[3]), vstrImageFilenames, vTimestamps)

例項解釋:

#include <iostream>
 using namespace std;

int   main(int   argc,   char*   argv[])  
 {  
   int   i;  
   for   (i   =   0;   i<argc;   i++)  
    std::cout<<i<< ":"<<argv[i]<<std::endl;
   return   0;  
 } 

輸出:  

[email protected]:~/桌面$ g++  test.cpp  -o    test
[email protected]:~/桌面$ ./test  1 2 3
0:./test
1:1
2:2
3:3