Toy copy ======== Someone it has been said that every program starts as **cat**, which copies standard input to standard output. It's one of the first programs in Kernighan and Ritchie. .. literalinclude:: /../../toyproblem/toycopy.p :language: pascal The challenge is to restructure this program so that i/o can be sent to whereve we want. Here we've rewritten the program to use external routines for the i/o. Note that we've had to change the program logic slightly, because in C the EOF occurs only when we 'read past the end'. .. literalinclude:: /../../toyproblem/toycopy2.p :language: pascal And here we've implemented these external routines. .. literalinclude:: /../../toyproblem/toycopy2_io.c :language: c