[C] How to use execvp
#include<stdio.h>
#include<stdlib.h>
#include<unistd.h>
#include<sys/types.h>
int main()
{
char *arg_list[] = {
"ls",
"-l",
"/tmp",
NULL
};
execvp("ls",arg_list);
printf("The end of the program. \n");
}
Result :
total 12
srw------- 1 freeman freeman 0 5月 31 22:26 geany_socket.21900549
drwx------ 2 freeman freeman 4096 1月 1 1970 orbit-freeman
drwx------ 2 root root 4096 5月 31 22:05 pulse-PKdhtXMmr18n
drwx------ 2 freeman freeman 4096 5月 31 22:05 ssh-vfnlXVpNsFd9
2014年5月31日 星期六
訂閱:
張貼留言 (Atom)
0 意見:
張貼留言