Lasso Soft Inc. > Home

[File]

Casts a file as an object. Requires the name and path to a file as a parameter, in addition to the open and read mode indicators.

When a file connection is opened using the [File] tag, several different open modes can be used. These modes optimize the file connection for best performance depending on the purpose of the connection. A read mode may also be specified to determine how the file will be read (by line or by character). The open and read modes are described below.

  • Syntax
  • Parameters
[Var:'File Variable'=(File: 'file name', Open Mode, Read Mode)]
Required Parameters
'File path' The name and path to a file.
Open Mode The open mode defines the purpose and permissions of the file connection, and may be one of the following values:
  • File_OpenRead – Sets the file connection to read-only.
  • File_OpenWrite – Sets the file connection to write-only.
  • File_OpenReadWrite – Sets the file connection to read and write.
  • File_OpenWriteAppend – Sets the file connection to write and append data.
  • File_OpenWriteTruncate – Sets the file connection to write and truncate data.
  • Read Mode The read mode defines whether the file will be read by line or by character when using the [File->Get] tag, and may be one of the following values:
  • File_ModeChar – Reads a file character by character.
  • File_ModeLine – Reads a character line by line.
  • Examples

    To cast a file as an LDML object:

    Use the [File] tag. The example below casts a local file named myfile.txt as an LDML object in read-only/character mode. Note that no single quotes are used around the open and read mode designators, as they are type constants and not strings.

    [Var:'File'=(File: 'myfile.txt', (File_OpenRead), (File_ModeChar))]
    Tag Link [File] Category File
    Type Substitution Data Source Any
    Support Preferred Version 7.0
    Output Type File Security Tag,File
    Implementation LCAPI Sets Lasso 8.5, Lasso 8.0, Lasso 7.0

    Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.

    LassoSoft Inc. > Home

     

     

    ©LassoSoft Inc 2015 | Web Development by Treefrog Inc | PrivacyLegal terms and Shipping | Contact LassoSoft