Convert command line argument to string

后端 未结 7 1266
囚心锁ツ
囚心锁ツ 2021-01-31 08:43

I have a program that reads hard-coded file-path and I want to make it read file-path from command line instead. For that purpose I changed the code like this:

#         


        
7条回答
  •  半阙折子戏
    2021-01-31 09:14

    It's simple. Just do this:

    #include 
    #include 
    #include 
    
    int main(int argc, char *argv[])
    {
        std::vector argList;
        for(int i=0;i

    @Benjamin Lindley You are right. This is not a good solution. Please read the one answered by juanchopanza.

提交回复
热议问题