First, I need to execute two commands with system(), for example, I receive an string and open this string with an text editor, like this:

```
$ ./myprogram string1

```

And the output should be a command like this:

```
$ vim string1

```

But, I cannot find a way to do this like this pseudo code:

```
system("vim %s",argv[1]); //Error:

test.c:23:3: error: too many arguments to function 'system'
   system("vim %s",argv[1]);

```

Therefore, my solution is store the argv[1] on a char array that already initialized with four characters, like this:

```
char command[strlen(argv[1])+4];
command[0] = 'v'; command [1] = 'i'; command[2] = 'm'; command[3] = ' ';

```

And assign the argv[1] to my new char array:

```
for(int i = 0; i < strlen(argv[1]) ; i++)
    command[i+4] = argv[1][i];

```

And finally:

```
system(command);

```

But, if the arguments given to my program has less than 3 characters, its works fine, but if not, some weird characters that I do not expect appear in the output, like this:

```
./myprogramg 1234

```

And the output is:

```
$ vim 12348�M�

```

How can I solve this bug and why does this happen? 

The full code is:

```
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 int main (int argc,char **argv) {

    char command[strlen(argv[1])+4];
    command[0] = 'v'; command [1] = 'i'; command[2] = 'm'; command[3] = ' ';

    for(int i = 0; i < strlen(argv[1]) ; i++)
        command[i+4] = argv[1][i];

        system(command);

    return 0;
}

```