Subsections

- Exercises

# String terminators

One of the really useful facilities available for reading data from books is that of being able to specify when the reading of a string should terminate. Usually, this is set as the end of the line only. However, using the procedure `make term`, the string terminator can be a single character or any one of a set of characters. The header of `make term` is

       PROC make term=(REF FILE f,STRING term)VOID:

so if you want to read a line word by word, defining a word as any sequence of non-space characters, you can make the string terminator a space by writing

       make term(inf,blank)

because `blank` (synonymous with `" "`) is rowed in the strong context of a parameter to `[]CHAR`. This will not remove the end-of-line as a terminator because the character `lf` is always added whatever characters you specify. You should remember that when a string is read, the string terminator is available for the next read--it has not been read by the previous read (but see 9.9).

## Exercises

9.5
  Write a program called `copy` which copies its input text book to its output text book, stopping when a blank line is read (all blanks or zero length). The input book is called `inbook` and the output book `outbook`. Ans
9.6
  Rewrite the program in exercise A using `make term`. The data should be read from a book called `lines` and written to a book called `words`. Write one word to a line. Terminate the `lines` with an asterisk (`*`) on a line by itself. Ans