Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write a C code with online gdb . com, that can run with the following zipped file is _ test _ files.Please show proof

Please write a C code with online gdb.com, that can run with the following zipped file is_test_files.Please show proof of output and explain how to run the code with the uploaded file to get the output!
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

Database Concepts

Authors: David M. Kroenke

1st Edition

0130086509, 978-0130086501

More Books

Students also viewed these Databases questions

Question

3. Discuss the process of behavior modeling training.

Answered: 1 week ago