 | | Note the calls to read and write: when calling read, we pass the size of the buffer buf, but when calling write, we pass the number of bytes read, n. If we were to pass the size of the buffer instead, then we would end up writing out some number of correct bytes (the ones we read) and a large number of “garbage” bytes. | |
|