CMPSC 311, Introduction to Systems Programming

Introduction to Unix
Solutions to Exercises

Exercise 2
[CS:APP]  The error-handling in the APUE version is explicit in the program, while the error-handling in the CS:APP version is implicit in the Read() and Write() wrapper functions.  More obviously, the APUE version copies more than one byte in one operation, so it probably runs faster.  Sometimes, though, it's much more convenient to process one character at a time, improving the logic of the program, and we would need to know how much we paid for the programmer's convenience with the user's runtime.

[CP:AMA]  Two files are named on the command line.  There might be a problem, and the copying operation doesn't make much sense, when the files are identical.

Last revised, 9 Jan. 2012