How to execute a program using c code in linux -
i want write program runs program dont know correct way using 1 of exec functions. thought of first using fork , make child run program. can me this?
thank you!
code:
char * arg[] = {"./"} execve(argv[0],path,null);
and other different combinations different exec functions
you can use exec functions.
int execl(const char *path, const char *arg, ...);
for example,
execl("/bin/ls","ls","-l",null);
in path can give executable code run. if want give argument functions can give in double quotes.
Comments
Post a Comment