! This does the same as PrintAnything, but the output is sent to a ! byte array in memory. The first two arguments must be the array ! address and length; the following arguments are interpreted as ! for PrintAnything. The return value is the number of characters ! output. ! If the output is longer than the array length given, the extra ! characters are discarded, so the array does not overflow. ! (However, the return value is the total length of the output, ! including discarded characters.) [ PrintAnyToArray _vararg_count arr arrlen str oldstr len; @copy sp arr; @copy sp arrlen; _vararg_count = _vararg_count - 2; oldstr = glk($0048); ! stream_get_current str = glk($0043, arr, arrlen, 1, 0); ! stream_open_memory if (str == 0) return 0; glk($0047, str); ! stream_set_current @call PrintAnything _vararg_count 0; glk($0047, oldstr); ! stream_set_current @copy $ffffffff sp; @copy str sp; @glk $0044 2 0; ! stream_close @copy sp len; @copy sp 0; return len; ];