Next: qr() Up: MacAnova Help File Previous: pushmodel()   Contents

putascii()

Usage:
putascii(vec [,keep:T]), vec a vector of integers > 0 and <= 255
putascii(vec, file:fileName [, new:T])



Keywords: output, character variables
putascii(Vec) prints the characters corresponding to the elements of the
vector Vec, considered as ASCII codes.  All the codes must be integers
between 1 and 255, inclusive.  For example, putascii(run(64,126)) prints
@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~

putascii(Vec1,Vec2,...) is equivalent to putascii(vector(Vec1,Vec2,
...)), if Vec1, ..., are REAL vectors.

The primary use of putascii() is to send control sequences to a
terminal.  See macro vt() for an example of its use.  On all machines,
any leading 7's are explicitly translated to beeps or bells.  For
example
  Cmd> putascii(vector(7,7,7,69,82,82,79,82))
rings the bell three times and prints ERROR.

Function getascii() is almost an inverse to putascii(), translating
CHARACTER variables to a vector of integers.

putascii(Vec,file:FileName [,new:T]) or putascii(Vec1, Vec2, ...,
file:FileName [,new:T]), where FileName is a CHARACTER variable or
quoted string, writes the ASCII codes on file FileName.  If new:T is an
argument, any information in the file will be destroyed; otherwise the
codes are added at the end of the file.

putascii(Vec,keep:T) or putascii(Vec1,Vec2,...,keep:T) returns a
CHARACTER variable whose characters have the ASCII codes.  For example,
putascii(run(4,8), keep:T) has value "\004\005\006\007\010".  Use of
new:T with file:FileName is illegal.

The usage putascii(Vec, keep:T) is somewhat similar to makesymbols(Vec,
keep:T) since both translate ASCII codes to characters.  The difference
is that putascii() returns a CHARACTER scalar with length(Vec)
characters while makesymbols() returns a CHARACTER vector of
length(Vec), with each element a single character.  See makesymbols()
for details.

See also print(), write().


Gary Oehlert 2003-01-15