INPUT - Function

INPUT(number, [#] filenumber)

Returns a number of characters from a file (String).

numberThe number of characters to return (Integer).
filenumberThe number of the file (Integer).

* The "number" can be any numeric expression.
* Any data read with this function is usually written to a file with the PRINT or PUT statements.
* Use this function with files opened in Input or Binary mode.
* Unlike the INPUT Statement, this function returns all of the characters it reads, including commas, carriage returns, line feeds, quotation marks and leading spaces.
* With files opened for binary access, an attempt to read through the file using this function until EOF returns True, will generate an error.
* You can use the CLOSE statement to close a text file.
* You can use the LINE INPUT statement to reads a single line from an Open sequential file and assigns it to a string.
* You can use the LOF and LOC functions instead of EOF when reading binary files with Input, or use GET when using the EOF function.
* You can use the OPEN statement to open a text file or csv file.
* You can use the INPUTB function that is used with byte data.
* You can use the INPUT$ function to return a String data type instead of a Variant data type.
* You can use the INPUTB$ function to return a String data type instead of a Variant data type.
* The equivalent .NET function is Microsoft.VisualBasic.FileSystem.Input
* This function is not available in Access.
* For the Microsoft documentation refer to

Dim MyChar As String 
Open "C:\Temp\MyText.txt" For Input As #1
Do While Not EOF(1)
    MyChar = Input(1, #1)
    Debug.Print MyChar
Close #1

© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited Top