input# deviceID, var1 [,var2 ...]
This statement reads text data from the open file or serial port specified by
deviceID, and stores the data into the specified variables. The variables
var2 etc. must be numeric, container, or string variables (not record variables).
deviceID equals zero, then
input# reads data from the keyboard.
var1[,var2...] is identical to
input var1[,var2 ...].
The data in the file (or coming in through the serial port) should be formatted as text items delimited by commas and/or carriage-returns. Each item is assigned to a separate variable. Some data conversion may occur during the assignment; see the input statement for more details.
deviceID specifies a file, then
input# reads a line of text from the file, beginning at the current "file mark" position (which is usually at the beginning of the line), and ending when a carriage-return character is encountered, or the end of the file is encountered, or 255 characters have been read, whichever occurs first. The file mark is then advanced to a position just past the last character read.
input# then attempts to assign each of the comma-delimited items in the text line to one of the variables (
var2 etc.) in the variable list. If there are more items in the text line than variables in the list, the extra items are discarded. If there are fewer items in the text line than variables in the list, then zeros or null strings are assigned to the extra variables.
deviceID specifies an open serial port (i.e., if its value is
input# behaves in a similar way, except that the concepts of "file mark" and "end of file" generally don't apply.
input# is the slowest method of reading data from disk. For greater speed, try using
read# instead. (Note however that
read# generally interpret the data in the file differently.)
input# can read the data created by
print#. Note, however, that if you want to create data items that are delimited by commas, you must explicitly print comma characters between them.
print# does not automatically insert commas between the items it puts out.
If the file mark is already at the end of file when you execute
input#, FutureBasic generates an "Input past end of file" error. To prevent this situation, check the value of
eof(deviceID) before executing
input; line input#; open; read#; write; print#; eof