LOTUSSCRIPT LANGUAGE


Input # statement
Example

Reads data from a sequential file and assigns that data to variables.

Syntax

Input #fileNumber , variableList

Elements

fileNumber


variableList
Usage

The following table shows how the Input # statement reads characters for various data types.
variableList data type How Input # reads characters
Numeric variableThe next non-space character in the file is assumed to begin a number. The next space, comma, or end-of-line character in the file ends the number. Blank lines and non-numeric values are translated to the number 0.
String
variable
The next non-space character in the file is assumed to begin a string. Note these special conditions:
If that character is a double quotation mark ("), it is ignored; however, all characters following it (including commas, spaces, and newline characters) up to the next double quotation mark are read into the string variable.
If the first character is not a double quotation mark, the next space, comma, or end-of-line character ends the string.
Blank lines are translated to the empty string ("").
Note that tab is a non-space character.
Fixed-length string variableLotusScript reads this according to its length. For example, LotusScript reads a variable declared as String *10 as 10 bytes.
Variant variableThe next non-space character in the file is assumed to begin the data.
If the data is:
Empty (a delimiting comma or blank line), LotusScript assigns the variable the EMPTY value.
The literal "#NULL#", LotusScript assigns the variable the NULL value.
A date/time literal, LotusScript assigns the variable the DataType 7 (Date/Time).
A whole number, LotusScript assigns the variable the Data Type 2 (integer) if the number is in the legal range for integer; the DataType 3 (Long) if the number is in the legal range for Long but not within the range for integer; and otherwise the DataType 5 (Double).
A number with a fractional part, LotusScript assigns the variable the DataType 5 (Double).
If none of the above applies, LotusScript assigns the variable the String type.
If LotusScript encounters an EOF (end-of-file), input terminates and an error is generated.

LotusScript inserts "chr(10)" to represent the newline character in any multi-line string (for example, a string that you type in using vertical bars or braces). If you Print the string to a file, this newline character will be translated into the platform-specific newline character(s). If you Write the string to a file, no translation is done.

Note Newline does not mean either chr(10) or chr(13) on all platforms. Newline is the character or sequence of characters that is used to mark the end of a line. This may be chr(10), or chr(13), but it may also be something else, because the actual value of newline depends on the platform.

Note When reading a multiline string from a sequential file written by the Write # statement, use Input, not Line Input.

When reading record-oriented data, using a random file with the Get statement is easier and more efficient than using Input #. Use Get for reading record-oriented data (a random file); use Input # for reading text data (a sequential file).

Example
See Also