The final change we'll make to our resource manager is to give it the ability to handle the client's write() requests. Initially, the change will be very simple—the client can write a number up to MAX_DIGITS (currently 10) digits in length, and when the client closes the file descriptor, that number will be jammed into the current count value. This lets you do the following from the command line:
echo 1433 >/dev/webcounter.gif
or:
echo 1433 >/dev/webcounter.txt
We're not going to make any distinction between the GIF-encoded filename and the text filename; writing to either will reset the counter to the specified value, 1433 in this case (yes, it's a little odd to write a plain ASCII string to a .gif file).