Hallo, ich habe folgenden code:
1 | #include <stdio.h> |
2 | #include <stdlib.h> |
3 | #include <errno.h> |
4 | #include <unistd.h> |
5 | |
6 | int main(void){ |
7 | char com[20]; |
8 | fgets(com, sizeof(com), stdin); |
9 | printf("Befehl: $s\n", com); |
10 | |
11 | execlp(com, com, NULL); |
12 | printf("%s\n", strerror(errno)); |
13 | |
14 | exit(0); |
15 | }
|
Bei Eingabe von z.B. ls kommt als Fehler kommt "no such file or directory". Gebe ich aber "ls" direkt als Argumente von execlp() ein, funktioniert es. Woran liegt das?