Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5b

Application v 5.24b

  

 

Chapter SixFile Functions (continued)

OpenMappedTextFile Function

Overview

The OpenMappedTextFile function opens a file as a Mapped Text Object.

Syntax/Parameters

Syntax

handle = OpenMappedTextFile ( string name, [qword mode] );

Parameters

name

A string containing a fully qualified path and filename.

mode

An option qword containing bitwise flags specifying the method of opening the Mapped Text Object. The flags are as follows:

  MFC_OPEN_READ 0x0000000000000008   Open as read-only share
  MFC_ALLOW_READ_ONLY 0x0000000000000010   Open allow read-only
  MFC_NO_CACHE 0x0000000000000080   Do not read cache (HTTP)
  MFC_RECOVERY_TRACKING 0x0000000000001000   Use recovering tracking
  MFC_UNDO_TRACKING 0x0000000000002000   Keep undo information
  MFC_ALLOW_TABS 0x0000000000004000   Allow and process tabs, by default tabs are converted and formatted to spaces
  MFC_ALLOW_SHARE_TRACKING 0x0000000000010000   Allow file share tracking

 

If omitted, the value is 0x00000000 is used, meaning open as Read/Write, allow read share and converted tabs.

Return Value

Returns a handle to a Mapped Text Object or NULL_HANDLE on failure. Use the GetLastError function to retrieve error information.

Remarks

Mapped Text Objects allow files and strings to be accessed, modified and altered at a high-level by line number or by row (X) and column (Y) position. Mapped Text Objects also allow more complicated editing actions, such as undo, through transactions, which makes them ideal for controlling text inside objects such as edit windows. They also do not alter the source file until the object is saved or exported via function calls.

When a file is opened, it is mapped line by line into an entry point table which is then used to manage changes to the data model. Under the Mapped Text Object model, alterations to a file are not saved until MappedTextSave is called.

If opening with a schema, such as HTTP, the MFC_OPEN_READ must be set since such files cannot be opened with write access.

Mapped Text Objects support UNICODE and accept line feed, carriage returns, and a combination thereof as line endings.

A Mapped Text Object should be closed via the CloseHandle function.

Related Functions

Platform Support

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

Legato IDE, Legato Basic