The Charout function attempts to write a sequence of characters to an output stream and returns how many characters remain to be written. When all characters are written 0 is returned.
When all characters could not be written the NOTREADY condition is raised.
CAUTION: in some environments a Charout request may erase all existing data in the stream.
result = Charout( [ stream ] [, [ string ] [, start ] ] ) |
When the start argument is absent, text is written to the current write position associated with the stream. The write position is the offset where a prior Charout or Lineout request completed. Initially the write position is the end of the output stream.
When the string and start arguments are both omitted, the stream is CLOSED and 0 is returned.
When the string argument is omitted, and the start arguments is present the current write position of the stream is set to the start position, and 0 is returned.
Examples:
say Charout( , 'Howdy' ) -- writes the text to the default output stream, and returns the number of characters remaining to be written. say Charout( '', 'Shazam' ) -- writes the text to the default output stream, and returns the number of characters remaining to be written. say Charout( '', 'Abracadabra', 3 ) -- writes the text to the default output stream, at the 3rd character position, and returns the number of characters remaining to be written. say Charout( 'file1', 'Shazam' ) -- writes the text to the stream named 'file1', and returns the number of characters remaining to be written. say Charout( 'file1', , 3 ) -- sets the write position of the stream named 'file1' to the 3rd character position, and returns 0 say Charout( 'file1' ) -- closes the stream named 'file1', and returns 0 |