| Input # Statement |
Syntax
Input #filenumber, varlist
filenumber
Use: Required
Data Type: Integer
Any valid file number.
varlist
Use: Required
Data Type: Any
Comma-delimited list of variables or user-defined types.
Description
Reads delimited data from a sequential file opened in input or binary mode.
Rules at a Glance
Use Input# only with files opened in input or binary modes.
Variables in varlist can't be array or object variables.
Both the type and position of data items in the file must match the variables in varlist.
If Input# expects to find a numeric value based on the type of a variable in varlist, and the data in the file isn't numeric, the variable is assigned a zero value. When reading the value of a variable, the function won't perform any data conversion. This means, for example, that if your program reads the string "10" and assigns it to a long integer variable named lngVar, the value of lngVar is 0.
Input# strips off quotation marks ("") it finds around strings.
After Input# reads varlist, it advances the file pointer to the first unread variable or, if the file contains no additional delimited data, to the end of the file.
If the end of the file is reached during an Input#, an error is generated.
Input# assigns string and numeric data to the relevant variable in varlist without modification; however, other types of data can be modified as shown in the following table.
| Data | Value Assigned to Variable |
|---|---|
| Delimiting comma or blank line | Empty |
#NULL# | Null |
| #TRUE# or #FALSE# ... |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access