Tutorial 11 (Dec 5): copying file exercise, office hours reminder
Exercise: copying files using file I/O
We will go through the exercise mentioned last week, where you copy a file using file IO (input/output). After that, it will be a work period.
[Exercise: copy.s][4924B]
[input.bin][808B]
Note that you can copy most files, since the program copies a file byte by byte. The input.bin file is just provided for convenience.
Usage: ./copy inputFileName outputFileName
The above solution simply combines code from the readlong.asm and writelong.asm examples provided by Prof. Manzara last week. Upon reading data from the input file to the buffer, we just write out from the buffer to the output file. One difference is that we read/write 1 byte at a time, instead of 8 bytes. This allows us to copy most files without errors. The readlong.asm and writelong.asm examples read 8 bytes at a time, because we expected the input.bin file to store long ints (8 bytes).
Office hours
My office hours are back to 2-4pm on Monday and Wednesday this week, as I am no longer covering the 3-4pm tutorial.