C programming
Hi,
I have a problem in doing C programming. Actually, in my code I have to pass 2 arguments like:
less filename.c
I would like to know how can I display my file by creating a child process by giving the above arguments?. Also, how can I use such arguments in the execvp(), function of a child process?
Thanks!
Code:
pid_ t pid;
char* argv[100];
if((pid=fork())==0)
// It works fine for "ls" only but not for 'less Filename'.......????
excevp(argv[0], argv)
perror(argv[0]);
exit(0);
else
wait(NULL);
|