How to use execl?

You can check the execl’s man document like below.

int execl(const char *path, const char *arg, ... /* (char  *) NULL */);

The const char *arg and subsequent ellipses in the execl(), execlp(), and execle() functions can be thought of as arg0, arg1, ..., argn.  Together they describe a list of one or more pointers to null-terminated  strings  that represent the argument list available to the executed program.  **The first argument, by convention, should point to the filename associated with the file being executed.**  The list of arguments must be terminated by a null pointer, and, since these are variadic functions, this pointer must be cast (char *) NULL.

The first parameter points to the filename associated with the file being executed.

BR,

Leave a Comment