Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN c++/C Unix: 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)

IN c++/C Unix:

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.

Do not use system() function call in your program.

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.

You should use some of the following system functions .

open, openat, creat, open, lseek, read, write.

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. 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases On The Web Designing And Programming For Network Access

Authors: Patricia Ju

1st Edition

1558515100, 978-1558515109

More Books

Students also viewed these Databases questions