If I try to executes these commands:
int main(int argc, char* argv[])
{
execl("/bin/echo","echo","list ","of", "files:\n",NULL);
execl("/bin/ls","ls","-al",NULL);
return 0;
}
Only the first one gets executed, why?
execl REPLACES the current process - it's not a subroutine. You might try using system()
instead.