How to use execvp()

The first argument is the file you wish to execute, and the second argument is an array of null-terminated strings that represent the appropriate arguments to the file as specified in the man page. For example: char *cmd = “ls”; char *argv[3]; argv[0] = “ls”; argv[1] = “-la”; argv[2] = NULL; execvp(cmd, argv); //This will … Read more