All pastes #233103 Raw Edit

execv example for ls

public c v1 · immutable
·published 2006-11-01 19:14 UTC
rendered paste body
#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);}