open
opens a file for unbuffered reading or writing
Calling Sequence
Parameters
Description
Examples
open(name, mode)
name
-
name of the file to be opened
mode
one of READ or WRITE
The open function opens the file with the specified name for unbuffered reading or writing (as specified by mode) and returns a file descriptor (a small integer).
RAW file I/O is always done with a file type of BINARY.
The special file names 'default' and 'terminal', referring to the current and top-level input or output streams, cannot be used with open.
If the file is being opened for reading and does not exist, open generates an error.
If the file is being opened for writing and does not exist, it is created if possible; otherwise, open generates an error.
If the file is already open, open generates an error.
If the limit for the maximum number of simultaneously open files has been reached, open generates an error.
fd≔open⁡testFile,WRITE
fd≔0
fprintf⁡fd,This is a test\n
15
close⁡fd
See Also
close
file_types
FileTools[Binary][Open]
FileTools[Text][Open]
fopen
IO_errors
Download Help Document