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

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -