Summary Files Commits Branches @commit @diff @stats
path: root / Year 3 / System programming / Practicum4 / ex3.c
diff options
context:
space:
mode:
1 files changed, 13 insertions, 0 deletions
-rw-r--r--Year 3/System programming/Practicum4/ex3.c13
diff --git a/Year 3/System programming/Practicum4/ex3.c b/Year 3/System programming/Practicum4/ex3.c
new file mode 100644
index 0000000..8df352b
--- /dev/null
+++ b/Year 3/System programming/Practicum4/ex3.c
@@ -0,0 +1,13 @@
+#include <sys/types.h>
+#include <sys/wait.h>
+#include <unistd.h>
+#include <stdio.h>
+
+int main(int argc, char *argv[]) {
+ int status = -1;
+ int fpid = fork();
+ if (fpid == 0)
+ execl(argv[1], argv[1], (char*)NULL);
+ wait(&status);
+ printf("Exit status: %d\n", status);
+}