Reputation: 34810
I am calling execv
in my C code to launch an executable, but I want to set its working directory to something custom.
For example, in one case, I am launching ls
, but it lists the files in my original program's directory. But I want to set the working directory to something custom. How will I achieve it, such that, I'll set it to /usr/bin
and ls
will list the files in that dir. And don't give me a specific solution for ls
, it was just an example.
Upvotes: 9
Views: 6290