Input, Input$, InputB, InputB$ Functions |
Input(number, [#]filenumber)
number
Use: Required
Data Type: Numeric
Specifies the number of characters to return.
filenumber
Use: Required
Data Type: Integer
Any valid file number.
A string (in the case of Input$ and InputB$) or a variant string (if Input or InputB) containing numbercharacters.
Accesses data from within a file opened in input or binary mode.
Input should be used only once with files opened in input or binary mode.
The function begins reading characters from the current position of the file pointer.
Input returns all characters it reads, regardless of their type, returning the raw data of the file. This includes spaces, carriage returns, linefeeds, commas, end-of-file markers, unprintable characters, etc.
Once the function finishes reading number characters, it also advances the file pointer number characters.
The InputB and InputB$ function variants of the Input function are used to read binary data from a file. In this case, number refers to the number of bytes to read, as opposed to the number of characters.
Input reads data written to a file using either the Print# or Put statements.
Input always attempts to read precisely number characters from the file. If there aren't number characters from the position of the file pointer to the end of the file, Input attempts to read beyond the end of the file, thereby generating runtime error 62, "Input past end of file." To prevent this, you should use the LOF function after opening the file to insure that you don't attempt to read past the end-of-file marker.