Legato
Legato

GoFiler Legato Script Reference

 

Legato v 1.5d

Application v 5.25a

  

 

Chapter SixFile Functions (continued)

VariableToFile Function

Overview

The VariableToFile function writes the contents of a variable directly to a file.

Syntax/Parameters

Syntax

int = VariableToFile ( mixed data, string filename, [int bytes] );

Parameters

data

Any variable type as long as it occupies contiguous memory.

filename

A string containing a destination filename and path. This parameter supports UTF encoding for filenames with Unicode characters.

bytes

An optional int containing the number of bytes to write.

Return Value

Returns an int as ERROR_NONE or a formatted error code on failure. Use the GetLastError function to retrieve error information.

Remarks

The VariableToFile function can be used to perform file output functions such as writing a string as a web page to a file or dumping the contents of a complex array. The function will write directly to a file specified by the filename parameter. Only a single operation is allowed. If the file does not exist, it is created, and, if it exists, it is overwritten. If the value of the bytes parameter is larger than the size of the data parameter, the function will return an error.

The function presently only writes simple variables.

Related Functions

Platform Support

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

Legato IDE, Legato Basic