Run sleep in background in C language (Linux)

602 Views Asked by At

I am trying to call the sleep function with '&' in order to run it in thebackground.

The C program is going to replace the Terminal of linux.

The command line in C program (of Linux) has to include an execl command, but it is not working.

The command is:

execl(path, "sleep", "12&");

Path is : "/bin/sleep".

The execl runs properly if I don`t writes '&', but if I put '&' the output is:

"sleep: invalid time interval ‘12&’
Try 'sleep --help' for more information.".

What should I do? thanks, Haim

0

There are 0 best solutions below