Equinox Online Help - Language Reference - A to Z
FileOpen |
|||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Applies to | |||||||||||||||||||||||||
Syntax | FileOpen PathExpression, ModeExpression, HandleItem | ||||||||||||||||||||||||
Action | [Statement] Opens a random file containing binary data or a sequential file containing text data. | ||||||||||||||||||||||||
Scope | Usable anywhere | ||||||||||||||||||||||||
Notes | This statement can be used to directly access files from a method. The file name is specified in the PathExpression parameter and the ModeExpression parameter indicates the type of file access together with an optional share mode. In order to make the file appear on the server, prepend "SERVER:" (in any case) to the PathExpression. This prefix is ignored by the single user version. If the path specification is a relative one, it will start from the program directory - the Eqserver.exe directory for server files, and the Equinox.exe or Equinet.exe directory for everything else. Do not use method language file handling to manipulate Equinox files. The following constants specify the types of file access:
The share mode dictates what happens if someone else tries to open the file.The default is no file sharing: the file can be opened with no file sharing by any station as many times as required, but attempts to share the file using one of the modes below fail if it is already open. (so-called "compatibility mode"). File sharing must be enabled in the operating system. Note that the StreamReadWrite mode, available in Equinox version 2 and above, is now obsolete. Previously compiled code will continue to work as before, but in edited code you should substitute one of the other stream modes. If sharing support is required, the following constants can be added to the mode:
The HandleItem parameter is a variable of type Handle, which receives the handle of the file that was opened. If an error occurs, the value in HandleItem is undefined. You should always check the system workarea SysError, which is set to a non-zero value if an error occurs, otherwise zero. |
||||||||||||||||||||||||
Category | File IO | ||||||||||||||||||||||||
See Also | FileClose, FileCloseAll, FileDelimiters, FileInput, FileInputLine, FileLock, FileMovePosition, FileOpen, FilePosition, FilePrint, FileRead, FileReadLine, FileReadBinary, FileReadFile, FileUnlock, FileWrite, FileWriteBinary, FileWriteFile | ||||||||||||||||||||||||
Example | The following example opens a binary file for reading and writing whilst denying other network users the rights to read or write to the file. handle hnd The following example opens a binary file for reading and writing whilst denying other network users the rights to read or write to the file, using a UNC path for the file. handle hnd |