User Guide

Software Crestron SIMPL+
®
138 z SIMPL+
®
Language Reference Guide - DOC. 5797G
FileOpen
Name:
FileOpen
Syntax:
SIGNED_INTEGER FileOpen (STRING filename, INTEGER flags)
Description:
Opens a file.
Parameters:
FILENAME specifies the full path name or relative path name (link) of the file to
open/create.
FLAGS – File Open Flags. Can be combined using the Bitwise OR operator (|)
Return Value:
File handle if successful ( >= 0). Otherwise, file error code is returned.
NOTE: One of the following flags must be specified: _O_RDONLY, _O_WRONLY,
or _O_RDWR
KEYWORD FUNCTION
_O_TEXT Unused
_O_BINARY Unused
_O_APPEND Writes done at the end of file. Mutually exclusive with
_O_TRUNC
_O_CREAT Creates file. If _O_APPEND is specified, the file will created
only if it doesn't already exist.
_O_EXCL Open succeeds only if file doesn't already exist
_O_TRUNC Truncates file. Mutually exclusive with _O_APPEND
_O_RDONLY Open file for reading only
_O_RDWR Open file for both reading and writing
_O_WRONLY Open file for writing only
NOTE: FileClose() must be called before the executing thread is terminated. Failure
to do so will result in the file being left open and locked by the control system. Should
this happen, the file will not be able to be opened again until the control system is
rebooted.