beautypg.com

Fwrite – Visara Master Console Center Scripting Guide User Manual

Page 121

background image

Chapter 5 Script Commands

Scripting Guide

121

FWRITE

Syntax:

FWRITE( %FileNum, expr [, %NEWLINE] ) ==> %Success

Description:

Writes the expression to an open file.

Action:

The expr parameter is written to the open file (represented by the

FileNum).

Parameters:

%FileNum. Numeric expression. The file handle obtained from

FOPEN(). The file to write data to.
Expr. Numeric or string expression. The evaluated expression to write

into the file. Only one expression can be specified per FWRITE().
%NEWLINE. Boolean expression. Optional. Indicates if a newline
(ASCII 10) character should be appended to the end of the data. TRUE

means append the character, FALSE means omit it. Default value is
TRUE.

Returns:

Numeric value, as follows:
Value

Meaning

0 (FALSE)

Write to open file failed.

1 (TRUE)

Write to open file was successful.

Notes:

The format of the file created by FWRITE() is one parameter value per
line. Each line is separated by a newline character (ASCII 10), unless

%NEWLINE is FALSE.

Example:

%Handle := FOPEN( $FileName)
FWRITE( %Handle, “This is a sample string.”, TRUE)

See Also:

FCLOSE, FEXISTS, FOPEN, FREAD, FREWIND