Usually, files are copied hi(file: copying) either by reading a source file
character by character or line by line. The basic em(mold) to process streams
 hi(stream: processing) is as follows:
        itemization(
            it() Continuous loop:
            enumeration(
                eit() read from the stream
                eit() if reading did not succeed (i.e., tt(fail) returns
                        tt(true)), tt(break) from the loop
                eit() process the information that was read
            )
        )
    Note that reading must em(precede) testing, as
it is only possible to know after actually attempting to read from a file
whether the reading succeeded or not. Of course, variations are possible:
tt(getline(istream &, string &)) (see section ref(ISTREAMREAD)) returns an
tt(istream &), so here reading and testing may be contracted using one
expression. Nevertheless, the above mold represents the general case. So,
the following program may be used to copy tt(cin) to tt(cout):
        verbinclude(-a examples/copycincout.cc)

    Contraction is possible here by combining tt(get) with the
tt(if)-statement, resulting in:
        verb(
    if (!cin.get(c))
        break;
        )
    Even so, this would still follow the basic rule:
 `i(read first, test later)'.

    Simply copying a file isn't required very often. More often a situation is
encountered where a file is processed up to a certain point, followed by plain
copying the file's remaining information. The next program illustrates
this. Using tt(ignore) to skip the first line (for the sake of the example it
is assumed that the first line is at most 80 characters long), the second
statement uses yet another overloaded version of the lshift()-operator, in
which a ti(streambuf) pointer hi(inserting streambuf *) is inserted into
a stream. As the member tt(rdbuf) returns a stream's tt(streambuf *), we have
a simple means of inserting a stream's contents into an tt(ostream):
        verbinclude(-a examples/copystreambuf.cc)
    This way of copying streams only assumes the existence of a tt(streambuf)
object. Consequently it can be used with all specializations of the
tt(streambuf) class.
