diff options
[SP/P03] Solved exercises
1 files changed, 18 insertions, 0 deletions
| -rw-r--r-- | Year 3/System programming/Practice03/ex6.c | 18 |
diff --git a/Year 3/System programming/Practice03/ex6.c b/Year 3/System programming/Practice03/ex6.c new file mode 100644 index 0000000..d327085 --- /dev/null +++ b/Year 3/System programming/Practice03/ex6.c @@ -0,0 +1,18 @@ +#include <stdio.h> // perror +#include <sys/stat.h> // mkdir +#include <unistd.h> // symlink, rmdir + +int main(int argc, char* argv[]) { + if(mkdir("./test", 0777) < 0) { + perror("mkdir"); + return 1; + } + if(symlink("./test/myfile.txt", "./test/link.txt") < 0) { + perror("symlink"); + return 2; + } + if(rmdir("./test") < 0) { + perror("rmdir"); + return 3; + } +} |
