execlp() - mystery arg

E

Erik S. Bartul

as i understand if, the first argument of execlp() is a null terminated
string containing the path of the command which to be executed.

the second argument is an array of pointers to null terminated strings,
containing the arguments to be passed to said command, ending in a null
pointer.

my question is, what does the third argument do?
 
J

Joona I Palaste

Erik S. Bartul said:
as i understand if, the first argument of execlp() is a null terminated
string containing the path of the command which to be executed.
the second argument is an array of pointers to null terminated strings,
containing the arguments to be passed to said command, ending in a null
pointer.
my question is, what does the third argument do?

Something POSIX-specific. Ask in comp.unix.programmer.
 
S

Sean Kenwrick

Erik S. Bartul said:
as i understand if, the first argument of execlp() is a null terminated
string containing the path of the command which to be executed.

the second argument is an array of pointers to null terminated strings,
containing the arguments to be passed to said command, ending in a null
pointer.

my question is, what does the third argument do?
excelp() allows you to pass the arguments as a list strings terminated by 0:
e.g

execlp("MyProgram","parm1","parm2","another parm", (char *) 0);

The function you were (almost) describing is execvp() which takes the first
two parameters as you describe above but there is no third parameter....

Sean
 
D

David Rubin

Erik said:
as i understand if, the first argument of execlp() is a null terminated
string containing the path of the command which to be executed.
the second argument is an array of pointers to null terminated strings,
containing the arguments to be passed to said command, ending in a null
pointer.
my question is, what does the third argument do?

This terminates the argument list. man execlp.

/david
 
A

Alex Monjushko

Erik S. Bartul said:
as i understand if, the first argument of execlp() is a null terminated
string containing the path of the command which to be executed.
the second argument is an array of pointers to null terminated strings,
containing the arguments to be passed to said command, ending in a null
pointer.
my question is, what does the third argument do?

There is no such function is standard C. You may want to try:

comp.unix.programmer

Or, failing that, the documentation on your system. Seriously.
 
J

Jack Klein

excelp() allows you to pass the arguments as a list strings terminated by 0:
e.g

execlp("MyProgram","parm1","parm2","another parm", (char *) 0);

The function you were (almost) describing is execvp() which takes the first
two parameters as you describe above but there is no third parameter....

Sean

Please cite the references from any version of the ISO C Standard for
the above.
 
C

CBFalconer

Sean said:
excelp() allows you to pass the arguments as a list strings terminated by 0:
e.g

execlp("MyProgram","parm1","parm2","another parm", (char *) 0);

The function you were (almost) describing is execvp() which takes the first
two parameters as you describe above but there is no third parameter....

Please DO NOT post answers to off-topic questions in c.l.c. Refer
the OP to an appropriate newsgroup, where other posters are likely
to be able to criticise any faulty answers.

To the OP: Close to 50% of all answers posted anywhere are wrong
to some degree or other. Your only protection is to have this go
on in the open under the scrutiny of people knowledgeable about
the subject. execlp() does not exist in standard C, and thus does
not exist in c.l.c and we have absolutely no knowledge about it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,049
Latest member
Allen00Reed

Latest Threads

Top