up previous next
OpenOString

open output string

Syntax
OpenOString(S: STRING): DEVICE

Description
This function opens strings for output. The string S serves as the name of the device opened for input or output; one may use the empty string. OpenOString is used to write to a string with the help of print on .

Example
  D := OpenOString("");  -- open a string for output from CoCoA
  L := [1,2,3]; -- a list
  Print L On D;  -- print to D
  D;
record[Name := "", Type := "OString", Protocol := "CoCoALanguage"]
-------------------------------
  S := Cast(D, STRING);  -- S is the string output to D
  S; -- a string
[1, 2, 3]
-------------------------------
  Print " more characters" On D;  -- append to the existing output string
  Cast(D, STRING);
[1, 2, 3] more characters
-------------------------------

See Also