i know the exec family functions usage. but it is like same as
system function.
but kernel uses exec function to startup the c program.
so can anyone tell the exact usage of the exec function usage.
Any function in the exec*() family will be declared in a header which is
not among the standard C headers. The usual suspect is <unistd.h>,
including execl, execle, execlp, execlpe, execv, execve, execvp, execve,
and execvpe. In a system that claims to be POSIX-compliant, they are
governed, the last I checked, by POSIX 1003.2-1992 and 1003.1-2001, not
by anything to do with the C language. This means they are specific to
(a group of) implementations, not portable, and not part of C. Anyone
who calls himself "techgroups" should know how to read his documentation
and how to post to newsgroups concerned with UNIX (as suggested by
<unistd.h>) and POSIX rather than to a language newsgroup for which such
functions are obviously not topical.
If you are not running on a UNIX-like implementation or without a
claimed POSIX-compliant environment, you may be running on one, as in
MSDOS and WINDOWS have frequently been the case, that uses the
<process.h> header. Such systems conform to absolutely no standard at
all. Often in such systems the exec* family is just a synonym for the
spawn* family with the spawn* mode parameter set to P_OVERLAY. Again,
you ought know how to read your documentation and how to post to a
relevant (probably MSDOS, WINDOWS, 4DOS, or NDOS) newsgroup instead of
to this unrelated one.
Now, there are C textbooks that, despite what I have written above, deal
with these functions. That is because in early, pre-standardization
days most C users were also UNIX users and there was a good deal of
confusion about what was an implemtation or system function and what was
a C library function. Harbison & Steele's _C: A Reference Manual_ was
first published in 1985, four years before the first standard was
adopted. They have retained sections dealing with non-standard
"traditional" functions like this. Their explanation in the 5th edition
of the exec* family is probably as much as you could need, and is found
in section 16.7.1 (pp. 416-7).