Save argv to vector or string

后端 未结 2 815
面向向阳花
面向向阳花 2020-12-16 19:36

I need to save all arguments to a vector or something like this. I\'m not a programmer, so I don\'t know how to do it, but here\'s what I\'ve got so far. I just want to call

2条回答
  •  别那么骄傲
    2020-12-16 20:21

    i need to save all arguments to a vector or something

    You can use the range constructor of the vector and pass appropriate iterators:

    std::vector arguments(argv + 1, argv + argc);
    

    Not 100% sure if that's what you were asking. If not, clarify.

提交回复
热议问题