Re: execvp second argument question
- From: Barry Margolin <barmar@xxxxxxxxxxxx>
- Date: Sat, 02 Jun 2007 18:27:39 -0400
In article <1180745944.379655.266300@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
alij <aliasger.jaffer@xxxxxxxxx> wrote:
Hi,
If I have a an array of string (**char args), but the size of the
array is, lets say, 10, whilst the arguments are 2. If I set the third
index (index no 2) to '\0', will this work for the following?
In other words, the size of the array is larger than the number of
elements in the array (and I set the last element to '\0')
int rval;
rval = execvp(myCommand, args);
There's no way in C to tell how large an array actually is. That's WHY
execvp() requires you to set the last one to 0 -- it simply processes
everything up to there and stops. If there's other stuff in the array
beyond, it will be ignored.
--
Barry Margolin, barmar@xxxxxxxxxxxx
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
*** PLEASE don't copy me on replies, I'll read them in the group ***
.
- Follow-Ups:
- Re: execvp second argument question
- From: phil-news-nospam
- Re: execvp second argument question
- References:
- execvp second argument question
- From: alij
- execvp second argument question
- Prev by Date: Re: one function (in a library) - two (or more) names
- Next by Date: Re: execvp second argument question
- Previous by thread: execvp second argument question
- Next by thread: Re: execvp second argument question
- Index(es):
Relevant Pages
|