Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5d

Application v 5.25a

  

 

Chapter SixFile Functions (continued)

CreateFile Function

Overview

The CreateFile function creates a random-access Basic File Object that can be accessed for reading, writing, and random positioning.

Syntax/Parameters

Syntax

handle = CreateFile ( 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. If the name is empty, a temporary file is created. See Remarks below.

mode

An optional dword specifying rights to the file. The parameter can be a combination of bitwise flags. See the Section 6.2 File Access Modes function to see a description of the bits. If omitted, the file is created with read/write access exclusive.

Return Value

Returns a handle to the Basic File Object or 0 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 the Appendix or MSDN).

Remarks 

The CreateFile 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 Virtual File Cloud (VFC).

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.

If the name parameter is an empty string, a temporary file is created in the user’s temp folder (usually located at “%temp%”). Use the GetName function to retrieve the name of the file if needed. The temp file will automatically be deleted when the supporting application is shut down (not when script file ends).

The CreateFile function always overwrites and truncates existing files.

Related Functions

Platform Support

Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL

Legato IDE, Legato Basic