GoFiler Legato Script Reference
Legato v 1.5d Application v 5.25a
|
Table of Contents | < < Previous | Next >> |
Chapter Six — File Functions (continued)
Overview
The WriteLine function writes a line of text to a Basic File Object at the current position.
Syntax/Parameters
Syntax
int = WriteLine ( handle hBasicFile, string line, [parameters ... ] );
int = WriteLine ( handle hBasicFile, wstring line, [parameters ... ] );
Parameters
hBasicFile
A handle to a Basic File Object.
line
A string or wstring to write. If additional parameters are present, line is considered a formatted string. See Section 5.2 String Functions for more information on formatted strings.
parameters
Zero or more parameters to be formatted and inserted into line. If no parameters are supplied, line is simply passed through to the result string.
Return Value
Returns an int as ERROR_NONE or a formatted error code on failure. If hBasicFile is invalid, the function will return ERROR_INVALID_HANDLE. Use the GetLastError function to retrieve error information. The GetLastErrorMessage function may contain information to supplement the error code.
Remarks
The WriteLine function permits the usage of a formatted string to write information to the file. Formatted strings allow numeric and other data to be formatted into a string. The format of the string and the data to be inserted depend upon the structure of the line parameter and the contents of the additional parameters passed to the function. For more information on formatted strings, see Section 5.2 String Functions.
Each write operation will have a return and newline added (CR/LR or 0x0D/0x0A).
Note that when a wstring data is used as the line parameter, data written to the file will be in Unicode little endian format. Two considerations are important: (1) that the content of the resulting file is word (16-bit) aligned; and, (2) that the file have a Unicode header. Depending on the application, these considerations may not be important, but if the file is to be treated like a Unicode text file, they must be followed. If only the WriteLine function is used to write the file, alignment will not be an issue. To write a Unicode header, use the WriteBlock function, and add the 16-bit character 0xFEFF before writing text to the file. For example:
wchar uh;
uh = 0xFEFF;
WriteBlock(hFile, uh);
Note that the literal 0xFEFF cannot be written since its native size is 64-bits.
Related Functions
Platform Support
Go13, Go16, GoFiler Complete, GoFiler Corporate, GoFiler, GoFiler Lite, GoXBRL
Legato IDE, Legato Basic
Page revised 2024-12-13
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.