Answer to Exercise 95

| ANSWER TO EXERCISE 95
| The tricky part is working out the number of characters in the location name, and this is where `@output_stream` is so useful. This time `Replace` with:
    Array printed_text table 64;
    [ DrawStatusLine i j;
      i = 0->33; if (i==0) i=80;
      font off;
      @split_window 1; @buffer_mode 0; @set_window 1;
      style reverse; @set_cursor 1 1; spaces(i);
      printed_text-->0 = 64;
      @output_stream 3 printed_text;
      print (name) location;
      @output_stream -3;
      j=(i-(printed_text-->0))/2;
      @set_cursor 1 j; print (name) location; spaces(j-1);
      style roman;
      @buffer_mode 1; @set_window 0; font on;
    ];
Note that the table can hold 128 characters (plenty for this purpose), and that these are stored in `printed_text->2` to `printed_text->129`; the length printed is held in `printed_text-->0`. ('Trinity' actually does this more crudely, storing away the width of each location name.)

Back to the exercise in section 33

Mechanically translated to HTML from third edition as revised 16 May 1997. Copyright © Graham Nelson 1993, 1994, 1995, 1996, 1997: all rights reserved.