InputFields

Reads data from an open sequential file and returns a single dimension Variant array.

Syntax

variant = file.InputFields(Number)

The parts of the InputFields statement syntax are described in the following table.

Part Description
Number Number of comma-delimited fields to read from the file.

Remarks

Data read with the InputFields function is usually written to a file with WriteFields. Use this statement only with files opened in Input or Binary mode.

When read, standard string or numeric data is assigned to variables without modification. The following table illustrates how other input data is treated.

Data Value Assigned to Variable
Delimiting comma or blank line Empty.
#NULL# Null.
#TRUE# or #FALSE# True or False.
#yyyy-mm-dd hh:mm:ss# The date and/or time represented by the expression.
#ERROR errornumber# errornumber (variable is a Variant tagged as an error).

Double quotation marks (" ") within input data are ignored.

If you reach the end of the file while you are inputting a data item, the input is terminated and an error occurs.

Note To be able to correctly read data from a file into variables using InputFields, use the WriteFields statement instead of the LinePrint statement to write the data to the files. Using WriteFields ensures each separate data field is properly delimited.