Question
IN UNIX: Task #1. Write a C/C++ program (a4part1.c) to create a few directories as shown below in your current directory, a few files, and
IN UNIX: Task #1. Write a C/C++ program (a4part1.c) to create a few directories as shown below in your current directory, a few files, and a symbolic-link link1.
Program should make two folders(folder1 and folder2), one file(file3) and a symbolic link(link4) in the a4part1 directory.
Folder1 should have a file(file1.txt) and folder2 should have another file(file2.txt) ALSO THE LINK IN A4PART1 DIR SHOULD REFER TO FILE2.TXT.
You should use some of the following system functions (listed in APUE ch3 and ch4) to do this part.
APUE ch3 open, openat, creat, open, lseek, read, write.
APUE ch4 stat, fstat, fstatat, lstat, access, faccessat, umask, chmod, fchmod, fchmodat, chown, fchown, fchownat, lchown, link, linkat, unlink, unlinkat, remove, rename, renameat, symlink, symlinkat, mkdir, mkdirat, rmdir, chdir, fchdir, getcwd
For example, to change current directory, you should use chdir( ) function to change the directory (APUE 4.23 pages 135-137). You should use creat() function to create each file.
First (1), your C program will create a directory (a4part1) for this assignment, and then create the files and directories as shown below, using C function call(s), recursively (that is, in depth-first order and left to right). That is, folder1 will be created first, then file1, and so on. You should create link1 (a softlink to file2) after file3 is created.
Second (2), you type the command ("ls R") to get the listing of all the directories and files in a4part1 directory.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started