for CoderToHelpU

In today’s fast-paced academic environment, students often find themselves juggling multiple responsibilities, from attending classes and working part-time jobs to participating in extracurricular activities. The demands of modern education can be overwhelming, leaving students in search of effective solutions to manage their academic workload efficiently. One such solution is the use of Nursingpapertutors.com academic writing website. Nursingpapertutors.com academic writing website employ a cadre of experienced and knowledgeable writers who are well-versed in various academic subjects and writing styles. Nursingpapertutors.com professionals bring a wealth of expertise to the table, enabling them to produce well-researched and well-structured papers that meet the academic standards and expectations of students. Their familiarity with diverse subjects ensures that students can receive assistance across a wide spectrum of disciplines, from mathematics to literature, and from nursing to engineering.

 

Write a C program, myls.c, to list files in a given directory. myls takes one optional command line argument specifying the directory path (either absolute or relative path). If the argument is absent, files in current directory will be listed. Typical output should look like:

 

Case 1: directory argument absent

Case 2: directory argument present

 

$ myls

  myfile1

  myfile2

  myfile3

  myls

 

$ myls .

  myfile1

  myfile2

  myfile3

  myls

 

 

Remarks:

1.        display file names in separate lines, one file each line.

2.        exclude current directory entry (.) and parent directory entry (..)

3.        error handling. Whenever a system call fails, exit program and display an error message by using perror.

 

 

 

 

 

 

 

l  Bonus: 

 

Extend myls.c to myll.c to display more detailed information about the files listed:

 

1.        Modification time (2%). Hint: ctime() function covert time_t to string. consult time.h functions (Chapter 26.3 at Dr. King’s book).

2.        File size (1%).

3.        User name (1%). Hint: getpwuid()takes the uid variable in struct stat and return struct passwd which contains user name variable. Detail/example at: http://pubs.opengroup.org/onlinepubs/009695399/functions/getpwuid.html

http://pubs.opengroup.org/onlinepubs/000095399/basedefs/pwd.h.html

remember to include required header files to use these functions.

4.        Group name (1%). Hint: getgrgid()takes the gid variable in struct stat and return struct group which contains group name variable. Detail/example at:

http://pubs.opengroup.org/onlinepubs/009695399/functions/getgrgid.html

http://pubs.opengroup.org/onlinepubs/009695399/basedefs/grp.h.html

 

For more details about the struct stat definition, http://linux.die.net/man/2/stat.

 

Typical output looks like:

$ myll .

  myfile1          myname           mygroup          32        Apr  3 01:12

  myfile2          myname           mygroup          408      Apr  5 11:01

  myfile3          myname           mygroup          12        Apr  3 23:10

  myll               myname           mygroup          98        Apr  8 01:12

 

 

One of the significant challenges students face is time management. The demands of coursework, assignments, and exams can create immense pressure, leading to stress and a potential drop in academic performance. Nursingpapertutors.com academic writing website can be a valuable resource for students seeking to balance their responsibilities effectively. By outsourcing some of their academic tasks, students can free up time to focus on studying, participating in meaningful extracurricular activities, or even addressing personal obligations. This improved time management can alleviate the stress associated with academic overload. The ultimate goal of education is to enhance one’s knowledge and skills. Nursingpapertutors.com academic writing websites can play a vital role in achieving this goal by providing students with well-crafted papers that serve as models for their own work. These papers can offer valuable insights into effective research, organization, and writing, thereby empowering students to improve their academic performance over time.

 
Do you need a similar assignment done for you from scratch? We have qualified writers to help you. We assure you an A+ quality paper that is free from plagiarism. Order now for an Amazing Discount!
Use Discount Code "Newclient" for a 15% Discount!

NB: We do not resell papers. Upon ordering, we do an original paper exclusively for you.