up previous next
print to an output device
Print E:OBJECT On D:DEVICE
|
This command prints the value of expression E to the device D.
Currently, the command can be used to print to files, strings, or the
CoCoA window. In the first two cases, the appropriate device must be
opened with
OpenOFile
or
OpenOString
.
D := OpenOFile("my-test"); -- open "my-test" for output from CoCoA
Print "hello world" On D; -- print string into "mytest"
Close(D); -- close the file
D := OpenIFile("my-test"); -- open "my-test" for input to CoCoA
Get(D,3); -- get the first three characters (in Ascii code)
[104, 101, 108]
-------------------------------
Ascii(It); -- convert the ascii code into characters
hel
-------------------------------
Close(D);
|
See
OpenOFile
for an example using output strings.
For printing to the CoCoA window, just use
Print E which is short for
Print E On DEV.OUT.