execv () vs execvp ()


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers execv () vs execvp ()
# 1  
Old 10-31-2005
execv () vs execvp ()

what's the difference between the two?
# 2  
Old 10-31-2005
With execv(), the first argument is a path to the executable.

With execvp(), the first argument is a filename. It must be converted to a path before it can used. This involves looking for the filename in all of the directories in the PATH environment variable.
# 3  
Old 10-31-2005
in my unix book, it says:
int execv(const char* path, const char* argv[])
and
int execvp(const char* path, const char* argv[])
so it seems like they are exactly the same. this is getting me kind of confused Smilie
# 4  
Old 10-31-2005
Get a second opinion by looking at a man page. There are a lot of them online. Here is one.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Execvp with arguments

Hi, I'm trying to build my own little shell as an exercise. I want to run emacs from my shell so I'm using execvp() command. The problem is when I run it with arguments at background (e.g "emacs file1 &") it stays "hung" (I don't get the prompt back) while without arguments it runs ok ("emacs... (1 Reply)
Discussion started by: Rap_master
1 Replies

2. Programming

Linux fork, execv, wait question

Hi All, I have a program for class that needs to do the following: 1. Print the directory entries from the current directory using ncurses 2. Provide a prompt next to each directory entry and allow the user to enter commands that may or may not be about the file 3. Execute those commands in... (1 Reply)
Discussion started by: afulldevnull
1 Replies

3. Programming

If I malloc my parameters, then fork and execvp, where do I free them?

Hi, I do the following: i) malloc some parameter structures ii) fork iii) in the child, I call execvp using these parameters obviously, here I can never free() the structures as execvp should not return iiii) I am currently doing waitpid in parent then freeing, but this does not seem to work... (1 Reply)
Discussion started by: misha680
1 Replies

4. AIX

gmake[1]: execvp: /bin/sh: Arg list too long

I am having a code which will create archive after build. Ibuild code on IBM AIX 5.3. It supposed to create 2 archive after build. I am getting 1st archive successfully but when build starts for second archive after some processing it throws an following error message- ar cq... (4 Replies)
Discussion started by: milindb
4 Replies

5. Programming

after executing execvp()... program hangs up

Hi , I m actually trying to implement pipes program,but after executing the execvp(),my program is getting hanged up :mad: Actaully i m getting the desired output expected from execvp()...but once results are displayed on the output screen ,program is getting hanged up values of... (3 Replies)
Discussion started by: Crab
3 Replies

6. UNIX for Dummies Questions & Answers

execvp:ar:Arg list too long -> while linking

I get this error : execvp:ar:Arg list too long when i am trying to link the .obj files created on unix box. Any resolution to this? Thanks Mohit (1 Reply)
Discussion started by: mohitp
1 Replies

7. Programming

execl / execv ?

Hi, Is it possible to run a program from my C program using only the full pathname? for example if I wanna call: "ls", so I whould have to use: execl("/bin/ls", "ls", NULL); Is it possible to do this using only: "/bin/ls" thanks (1 Reply)
Discussion started by: owijust
1 Replies

8. UNIX for Dummies Questions & Answers

problem with execvp

i am having an application that contains a push button. On the click of this push button i want to call a executable file using execvp function block fo2 push button { char *args; args=NULL; execvp("/home2/xyz/app1.exe",args) } but after compilation when i press this button the... (3 Replies)
Discussion started by: kunu
3 Replies

9. Programming

execl, execv or execp

Hi! I'm writing a C program which gets from the command line a shell command (such as "ls" ) and I should execute it. My Q is: how can I send a command to the shell? I know I have to use one of the above functions, but I don't know how to use them. Thanks eyal (1 Reply)
Discussion started by: azran
1 Replies

10. Programming

execvp and execlp?

Hi mates, Is there any difference between execvp and execlp? any comment will be appreciated. abdul:) (1 Reply)
Discussion started by: abdul
1 Replies
Login or Register to Ask a Question