GoFiler Legato Script Reference
Legato v 1.5d Application v 5.25a
|
Table of Contents | < < Previous | Next >> |
Chapter Six — File Functions (continued)
Overview
The OpenFile function opens an existing file as a Basic File Object.
Syntax/Parameters
Syntax
handle = OpenFile ( string name, [dword mode] );
Parameters
name
A string containing a fully qualified path and filename. This parameter supports UTF encoding for filenames with Unicode characters.
mode
An optional dword specifying rights to the file. The parameter can be a combination of bitwise flags. See Remarks for modes. If omitted, the file is created with read access exclusive.
Return Value
Returns a handle to a Basic File Object or NULL_HANDLE on failure. Use the GetLastError function to retrieve error information. The GetLastErrorMessage function may contain information to supplement the error code. Error codes match Windows system error codes (for a list, see Appendix A — Legato SDK Standard Definitions or MSDN).
Remarks
The OpenFile function is a low-level function that allows for direct access to files located on a variety of devices. The files can be located on an NTFS or FAT file system. Access rights to the file are dependent on the user permissions set within the operating system. Files cannot be located on HTTP or FTP routines unless there is access via the VFC.
Access is controlled via the mode flags which can be a series of bitwise flags:
Definition | Bitwise Value | Description | ||||
FO_READ | 0x00000000 | Read-Only | ||||
FO_WRITE | 0x00000001 | Read and Write | ||||
FO_SHARE_READ | 0x00000010 | Allow Others to Open as Read | ||||
FO_SHARE_WRITE | 0x00000020 | Allow Others to Open as Write | ||||
FO_TEMP_FILE | 0x00010001 | Create/Delete Temp File Exclusive | ||||
FO_DELAY_CREATE | 0x00020001 | Create Only, Delay on Share | ||||
FO_CREATE_HIDDEN | 0x00080000 | Make Hidden on Create | ||||
FO_WAIT_OPEN | 0x00200000 | Delay on Share (open) | ||||
FO_FORCE_SPOOL | 0x00800000 | Forces Spool Out (requires create or FO_WRITE) |
The function returns a handle to the file that can be used for various types of I/O. The handle should be closed using the CloseFile or DeleteFile functions.
For significantly more flexibility in editing a file that is organized in lines of text, use a Mapped Text Object. Mapped Text Objects can be created through the CreateMappedTextFile and CreateMappedTextString functions.
Related Functions
Platform Support
Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL
Legato IDE, Legato Basic
Table of Contents | < < Previous | Next >> |
© 2012-2024 Novaworks, LLC. All rights reserved worldwide. Unauthorized use, duplication or transmission prohibited by law. Portions of the software are protected by US Patents 10,095,672, 10,706,221 and 11,210,456. GoFiler™ and Legato™ are trademarks of Novaworks, LLC. EDGAR® is a federally registered trademark of the U.S. Securities and Exchange Commission. Novaworks is not affiliated with or approved by the U.S. Securities and Exchange Commission. All other trademarks are property of their respective owners. Use of the features specified in this language are subject to terms, conditions and limitations of the Software License Agreement.