View the step-by-step solution to:

Nasm Assembly Programming Assignment 6 Goal: File properties program Instructions: Step 1.


Nasm Assembly Programming Assignment 6


Goal: File properties program

Instructions:

Step 1. Creating the assembly language file

Everything should be done the same way as the previous assignment.

Step 2. The application area

This assignment will give practice at using a struct and working with C library

functions.

The goal is very simple. Your program should take a file name and print the time

since the file was last modified.

We have already discussed in class how to find out the current time.

The tool you need to determine when a file was last modified is stat() or fstat().

These will return a lot of information about a file. You can ignore almost all of this

information except for the time modified.

See http://manpages.ubuntu.com/manpages/wily/man2/lstat.2.html

Additional discussion: https://stackoverflow.com/questions/11765683/how-toread-

file-folder-properties-in-linux

Note that stat can be used from the command line as well (see

http://labtestproject.com/linuxcmd/stat.html) but we want to call it as a function.

Time.h: http://pubs.opengroup.org/onlinepubs/007908775/xsh/time.h.html

Discussion of the difference between timeval and timespec:

https://stackoverflow.com/questions/31275131/c-timeval-vs-timespec

https://stackoverflow.com/questions/11153334/timespec-not-found-in-time-h

Aside: ISO 8601 date format: https://askubuntu.com/questions/355188/dateformat-

in-unix



Step 3. What your code should do

1. Your code should use STDIN and STDOUT for input and output. (This is the

default.) Use redirection on the command line to read from a file and write to a

file. Or you can take the file name from the command line as I did with the

Cryptoquip helper example I went over in class.

2. Your code should take a file name as input.

3. The code should output the length of time since the file was last modified. The

format is days, hours, minutes and seconds.

4. The program should call stat() or similar function to get the modification

time of the file in question.

5. This program should use glibc functions for input and output..


Step 4. Turning in the assignment

Turn in the following:

1. Commented listing file.

2. Demonstration of functioning for several different files that were modified

several days previously.

3. Include command line output of ls -l for the files so we can verify the

results.

Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question