|
| Previous: 3.2.11 NEWLINE | TOC | Index | Back | Next: 3.2.13 READ |
T.OPEN(path, mode) ! Str,Num => Fdesc
Open the file whose path is specified in 'path' in the given 'mode'. The exact format of 'path' depends on the operating system. The following modes exist:
| Mode constant | ReadOK | WriteOK | Create | Initial Position |
|---|---|---|---|---|
| T3X.OREAD | Yes | No | No | 0 |
| T3X.OWRITE | No | Yes | Yes | 0 |
| T3X.ORDWR | Yes | Yes | No | 0 |
| T3X.OAPPND | Yes | Yes | No | EOF |
When T3X.OWRITE is specified and a file with the given name already exists, it will be overwritten.
T3X.OAPPND is like T3X.ORDWR, but the file pointer will be positioned at the end of the file so that WRITE will append its output to the file.
OPEN returns a file descriptor for accessing 'path' on success and a negative number in case of an error.
When a T3X program starts up, there already are some open file descriptors which are by default connected to the user's terminal:
| Name | Descriptor | Mode |
|---|---|---|
| T3X.SYSIN | system input | T3X.OREAD |
| T3X.SYSOUT | system output | T3X.OWRITE |
| T3X.SYSERR | system error | T3X.OWRITE |
See also: CLOSE, READ, WRITE, SEEK
| Previous: 3.2.11 NEWLINE | TOC | Index | Back | Next: 3.2.13 READ |