up previous next
OpenIFile

open input file
Syntax

OpenIFile(S:STRING):DEVICE


Description
This function opens the file with name S for input. Input from that file can then be read with Get .

(Note: one would normally use Source to read CoCoA commands from a file.)

Example
D := OpenOFile("my-test");  -- open "my-test" for output from CoCoA
Print "hello world" On D;   -- print string into "mytest"
Close(D);
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 Also