execv example for ls
public c v1 · immutable#include <stdlib.h>#include <unistd.h>#define MY_MAX_ARGS 256const char mycommand[] = "/bin/ls";char *const myargs[MY_MAX_ARGS] = {"ls", "-l", "/root", NULL}; intmain (void){ execv (mycommand, myargs); exit (EXIT_SUCCESS);}