Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Using Onlinegdb, write a c code. Also i need the code to be a able to run a zipped file called Is _ test _
Using Onlinegdb, write a c code.
Also i need the code to be a able to run a zipped file called Istestfiles.zip
What to do
Write a C program myls whose behavior resembles that of the system command myls must
accept the following parameters:
$ mylsarsdirectory
If myls is provided with no parameters, it lists the names of all files in the current directory, one file
name per line.
directory specifies the name of a directory, in which case myls lists the names of files within that
directory.
a switch forces myls to display the names of hidden files whose names start with a In the
absence of this switch, hidden files are not listed.
switch sorts the filenames in the lexicographical order.
switch sorts the filenames in the reverse lexicographical order.
You must use system calls opendir readdir and closedir
Hint: consider using an array of strings to store the list of file names and then sorting it using qsort
Test mys using the files archived in this ZIP file, which contains several nested directories named
dirA,dirB, and dirA each with a number of short text files named filetxt Use the following
test cases when running myls from the directory at the same level with dirA and dirB:
What to submit?
A single C source code file with your work.
Several screenshots in PNG or JPG format showing the results of executing the test cases listed above
on a Linux terminal.
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