I am trying to do ps -A in code, but typing execlp("/bin/ps", "ps", "-A", NULL); outputs:
ps -A
execlp("/bin/ps", "ps", "-A", NULL);
/bin/ps: No such file or directory
But I can see ps in the file directory so I have no idea what is wrong.