Input loop is part of Short Circuit's Console Program Basics selection.
Task

Read from a text stream either word-by-word or line-by-line until the stream runs out of data.

The stream will have an unknown amount of data on it.




int C;
[repeat                                 \read file
        repeat                          \read line
                repeat  C:= ChIn(1);    \read word
                        ChOut(0, C);
                until   (C<^A ! C>^z) & (C<^0 ! C>^9);  \non-alphanumeric
        until   C < $20;                \CR, LF, or EOF
until   C = \EOF\ $1A;
]