# How to set up argument array for execvp()?



## palmboy5 (Aug 15, 2010)

Hey guys, I'm having trouble trying to run a command such as
[CMD=""]shasum -a 512 -b filename[/CMD]
within a program, using execvp().

For the *char *const argv[]* parameter of execvp() I set it to 

```
str[0] = "-a";
str[1] = "512";
str[2] = "-b";
str[3] = name;
str[4] = 0;
```
but it errors saying
[CMD=""]shasum: 512: No such file or directory[/CMD]

What am I doing wrong? x(

Thanks!


----------



## camelia (Aug 15, 2010)

argv[0] should contain the title of the program. It'll show up in ps(1) output. Note, you can set title from within program by setproctitle(3).


----------



## palmboy5 (Aug 16, 2010)

Oh right! Totally forgot that part, thanks! XD


----------

