Input function
Summary
Returns a specified number of characters from an open sequential file.
Syntax
Input(number, [ # ]filenumber)
The Input function syntax has these parts:
Part
Description
numberRequired. Any valid numeric expression specifying the number of characters to return.
filenumberRequired. Any valid file number.
Part
Description
numberRequired. Any valid numeric expression specifying the number of characters to return.
filenumberRequired. Any valid file number.
Example
Example
This example uses the Input function to read one character at a time from a file and print it to the Immediate window. This example assumes that TESTFILE is a text file with a few lines of sample data.
Dim MyChar
Open "TESTFILE" For Input As #1 ' Open file.
Do While Not EOF(1) ' Loop until end of file.
MyChar = Input(1, #1) ' Get one character.
Debug.Print MyChar ' Print to the Immediate window.
Loop
Close #1 ' Close file.
This example uses the Input function to read one character at a time from a file and print it to the Immediate window. This example assumes that TESTFILE is a text file with a few lines of sample data.
Dim MyChar
Open "TESTFILE" For Input As #1 ' Open file.
Do While Not EOF(1) ' Loop until end of file.
MyChar = Input(1, #1) ' Get one character.
Debug.Print MyChar ' Print to the Immediate window.
Loop
Close #1 ' Close file.