Answered step by step
Verified Expert Solution
Link Copied!

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 Is_test_files.zip
What to do?
Write a C program myls 1 whose behavior resembles that of the system command 1s. myls 1 must
accept the following parameters:
$ myls1[-ars][directory]
If myls1 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 myls1 lists the names of files within that
directory.
-a switch forces myls 1 to display the names of hidden files (whose names start with a "."). In the
absence of this switch, hidden files are not listed.
-s switch sorts the filenames in the lexicographical order.
-r 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 my1.s1 using the files archived in this ZIP file, which contains several nested directories (named
dirA,dirB, and dirA1, each with a number of short text files (named file*.txt). Use the following
test cases when running myls1 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.
image text in transcribed

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

Genomes Browsers And Databases Data Mining Tools For Integrated Genomic Databases

Authors: Peter Schattner

1st Edition

0521711320, 978-0521711326

More Books

Students also viewed these Databases questions