Search code examples
c++vectorexecvp

How to pass a vector to execvp


I want to pass a vector in as the second argument to execvp. Is it possible?


Solution

  • Not directly; you'd need to represent the vector as a NULL-terminated array of string pointers somehow. If it's a vector of strings, that is straightforward to do; if it's some other kind of data you would have to figure how to encode it as strings.