



PrintAnyToArray (lines 6026-6057)
Back to List
Browsing parserm.h
6026 ! This does the same as PrintAnything, but the output is sent to a
6027 ! byte array in memory. The first two arguments must be the array
6028 ! address and length; the following arguments are interpreted as
6029 ! for PrintAnything. The return value is the number of characters
6030 ! output.
6031 ! If the output is longer than the array length given, the extra
6032 ! characters are discarded, so the array does not overflow.
6033 ! (However, the return value is the total length of the output,
6034 ! including discarded characters.)
6035
6036 [ PrintAnyToArray _vararg_count arr arrlen str oldstr len;
6037 @copy sp arr;
6038 @copy sp arrlen;
6039 _vararg_count = _vararg_count - 2;
6040
6041 oldstr = glk($0048); ! stream_get_current
6042 str = glk($0043, arr, arrlen, 1, 0); ! stream_open_memory
6043 if (str == 0) return 0;
6044
6045 glk($0047, str); ! stream_set_current
6046
6047 @call PrintAnything _vararg_count 0;
6048
6049 glk($0047, oldstr); ! stream_set_current
6050 @copy $ffffffff sp;
6051 @copy str sp;
6052 @glk $0044 2 0; ! stream_close
6053 @copy sp len;
6054 @copy sp 0;
6055
6056 return len;
6057 ];
Last updated 27 February 2004. The librarian in charge of this page is Graham Nelson (graham@gnelson.demon.co.uk) assisted by C Knight. Please email any comments, suggestions or corrections to cedenqs@inform-fiction.org.