"Lewei Xu" <23*0*0*
8@s*u*e*t*u*a*e*u*a*> wrote:
> Thanks for pointing this out, I was just about to ask about this. As mkdir is a utility program that is called in the command line, how is it possible to use it in the C program? Could you highlight an exmaple of each in case I end up doing something stupid in my program?
We can trivially call a command-line utility from within a C program by using
for()
and
execl()
.
But the
mkdir
program does little more than call the
mkdir()
system-call, which we can do from within our own program.
If the action performed by an external program was far more significant, such as
sort
or
zip
, then it'd make far more sense to spawn the external program.