Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Makefile.a1: #Do not edit the contents of this file. CC = gcc CFLAGS = -Werror -Wall -g -std=gnu99 TARGET = filecopy directory OBJFILES = filecopy.o

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Makefile.a1:

#Do not edit the contents of this file. CC = gcc CFLAGS = -Werror -Wall -g -std=gnu99 TARGET = filecopy directory OBJFILES = filecopy.o directory.o

all: $(TARGET) filecopy: filecopy.c $(CC) $(CFLAGS) -o filecopy filecopy.c directory: directory.c $(CC) $(CFLAGS) -o directory directory.c runq1: directory.c ./directory runq2: filecopy.c ./filecopy input.txt output.txt runq2-err: filecopy.c ./filecopy runq2-strace: filecopy.c strace -c ./filecopy input.txt output.txt clean: rm -rf $(OBJFILES) $(TARGET) $(TARGET) *.exe *~ *.out *.dSYM.pkgf *.dSYM

General Instructions: - For this assignment, you must use C99 language syntax. Your code must compile using make without errors. You will be provided with a Makefile and instructions on using it. - Test your program thoroughly with the GCC compiler (version 5.4.0) in a Linux environment. - If your code does not compile, then you will score zero. Therefore, ensure you have removed all syntax errors from your code. Write a C program (directory.c) to perform various operations on directories and associated system functions. Directories are frequently used in daily life to organize files in a well-structured manner. This program would use various system calls that are available in C programming to perform the operations. The program should perform the following directory operations: - Creating a directory - Removing a directory - Getting the current working directory - Changing a directory (to one level up from the current directory) - Reading a directory - Closing a directory, the current directory The program should present the user with a list of options to select the directory operation and keep looping until the user enters " q " on the keyboard. You can use the makefile to compile and run the program. The expected output for executing make runq1 or. /directory is: - vscode /W23/CP386/Assignments/A01_W23 $./ directory Select the option(s) appropriately by entering the number: Enter 1 for creating a directory Enter 2 for removing directory Enter 3 for printing working directory Enter 4 for changing directory one level up Enter 5 for reading the contents of directory Enter 6 for closing the current directory Enter q to exit the program 1 Enter the Directory name you want to create: test Directory is Created Successfully. Select the option(s) appropriately by entering the number: Enter 1 for creating a directory Enter 2 for removing directory Enter 3 for printing working directory Enter 4 for changing directory one level up Enter 5 for reading the contents of directory Enter 6 for closing the current directory Enter q to exit the program 2 Enter the Directory name you want to remove: test Directory is removed Successfully. Select the option(s) appropriately by entering the number: Enter 1 for creating a directory Enter 2 for removing directory Enter 3 for printing working directory Enter 4 for changing directory one level up Enter 5 for reading the contents of directory Enter 6 for closing the current directory Enter q to exit the program 3 Current Working Directory is: /workspaces/W23/CP386/Assignments/A01_W23 Select the option (s) appropriately by entering the number: Enter 1 for creating a directory Enter 2 for removing directory Enter 3 for printing working directory Enter 4 for changing directory one level up Enter 5 for reading the contents of directory Enter 6 for closing the current directory Enter q to exit the program 4 Working Directory Before Operation:/workspaces/W23/CP386/Assignments/A81_W2: Directory Changed Successfully. Working Directory After Operation: /workspaces/w23/CP386/Assignments Select the option(s) appropriately by entering the nunber: Enter 1 for creating a directory Enter 2 for removing directory Enter 3 for printing working directory Enter 4 for changing directory one level up Enter 5 for reading the contents of directory Enter 6 for closing the current directory Enter q to exit the program 5 .DS_Store - metadata - vscode A.1_W23 AA2 F22 A93 3_F22 A94F22 A.55_F22 Assignment 63.xlsx Assignments_Questions BookCode C_projects Producer-Consumer RenoteSystensTempFiles autograder_samples-naster banker_yousuff.c final-src-osc10e test test12 test_project_make " Select the option(s) appropriately by entering the number: Enter 1 for creating a directory Enter 2 for removing directory Enter 3 for printing working directary Enter 4 for changing directory one level up Enter 5 for reading the contents of directory Enter 6 for closing the current directory Enter q to exit the program 6 Directory Closed Successfully, Select the option(s) appropriately by entering the nunber: Enter 1 for creating a directory Enter 2 for renoving directory Enter 3 for printing working directory Enter 4 for changing directory one level up Enter 5 for reading the contents of directory Enter 6 for closing the current directory Enter q to exit the program q vscode /kZ3/CP386/ Assignments/A01_w23 5 Important Note: When submitting a source code file to Gradescope, make sure to name it like: - directory.c

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

Visual Basic6 Database Programming

Authors: John W. Fronckowiak, David J. Helda

1st Edition

0764532545, 978-0764532542

More Books

Students also viewed these Databases questions