Work 4: I need information, Stat!

posted Oct 28, 2016, 6:13 AM by JonAlf Dyrland-Weaver   [ updated Oct 30, 2016, 4:42 PM ]
There is a function called stat. It is used to get information about a file. With your table partner, write a program that uses stat to display the following information about a file:
  • file size
  • mode (permissions)
  • time of last access (displayed in the following format: Fri Oct 28 09:03:01 2016
Added 10/31. In the same file:
  • Modify the size so it is printed out in human readable form (that is using B, KB, MB, GB).
  • Attempt to print out the permissions in ls -l form, ignoring the early bits that include the file type information (the permissions section of the mode is stored in the last 9 bits of the data type).

Github clone url: