311, Introduction to Systems Programming
Introduction to Unix
[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
- CS:APP, Fig. 10.2, has a shorter example of file copying, using
write(). Explain how it differs from APUE Fig.
- CP:AMA, pp. 568-569, has a longer example of file copying, using
checking the command-line arguments for misuse, and reporting problems
if the files can't be opened. It's a good example, in general,
which other features of misuse should also be considered?
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