Line Input # Statement
āĻāĻāĻāĻŋ āϧāĻžāϰāĻžāĻŦāĻžāĻšāĻŋāĻ āĻĢāĻžāĻāϞ āĻĨā§āĻā§ āĻā§āϰāĻŋā§ā§āĻŦāϞ⧠āϏā§āĻā§āϰāĻŋāĻ āĻĒā§āĻž āĻšā§āĨ¤
āϏāĻŋāύāĻā§āϝāĻžāĻā§āϏ:
Line Input #FileNumber As Integer, Var As String
āĻĒā§āϝāĻžāϰāĻžāĻŽāĻŋāĻāĻžāϰ:
FileNumber: āĻĄāĻžāĻāĻž āϧāĻžāϰāĻŖāĻāĻžāϰ⧠āĻĢāĻžāĻāϞā§āϰ āϏāĻāĻā§āϝāĻž āϝāĻž āĻāĻĒāύāĻŋ āĻĒā§āϤ⧠āĻāĻžāύāĨ¤ āĻāĻĒā§āύ āϏā§āĻā§āĻāĻŽā§āύā§āĻ āϏāĻš āĻĢāĻžāĻāϞāĻāĻŋ INPUT āĻā§āĻā§āĻžāϰā§āĻĄ āĻŦā§āϝāĻŦāĻšāĻžāϰ āĻāϰ⧠āĻ āĻŦāĻļā§āϝāĻ āĻ āĻā§āϰāĻŋāĻŽ āĻā§āϞāĻž āĻšā§ā§āĻā§āĨ¤
var: āĻā§āϰāĻŋā§ā§āĻŦāϞāĻāĻŋāϰ āύāĻžāĻŽ āϝāĻž āĻĢāϞāĻžāĻĢāϞ āϏāĻāϰāĻā§āώāĻŖ āĻāϰ⧠āĻĨāĻžāĻā§āĨ¤
Line Input# āϏā§āĻā§āĻāĻŽā§āύā§āĻ āϏāĻš, āĻāĻĒāύāĻŋ āĻāĻāĻāĻŋ āĻā§āϞāĻž āĻĢāĻžāĻāϞ āĻĨā§āĻā§ āĻāĻāĻāĻŋ āĻā§āϰāĻŋā§ā§āĻŦāϞ⧠āώā§āĻā§āϰāĻŋāĻ āĻĒāĻĄāĻŧāϤ⧠āĻĒāĻžāϰāĻŦā§āύāĨ¤ āĻĒā§āϰāĻĨāĻŽ āĻā§āϝāĻžāϰā§āĻ āĻĒā§āϰāĻĻāĻžāύ (Asc=13) āĻ āĻĨāĻŦāĻž āϞāĻžāĻāύāĻĢāĻŋāĻĄ (Asc=10) āĻĒāϰā§āϝāύā§āϤ āώā§āĻā§āϰāĻŋāĻ āĻā§āϰāĻŋā§ā§āĻŦāϞ āϞāĻžāĻāύā§āϰ āĻĒāϰ āϞāĻžāĻāύ āĻĒāĻĄāĻŧāĻž āĻšāϝāĻŧāĨ¤ āĻĢāϞāĻžāĻĢāϞā§āϰ āϏā§āĻā§āϰāĻŋāĻ āĻ āϞāĻžāĻāύ āϏāĻŽāĻžāĻĒā§āϤāĻŋ āĻāĻŋāĻšā§āύ āĻ āύā§āϤāϰā§āĻā§āĻā§āϤ āĻĨāĻžāĻā§ āύāĻžāĨ¤
āĻāĻĻāĻžāĻšāϰāĻŖ:
Sub ExampleWorkWithAFile
Dim iNumber As Integer
Dim sLine As String
Dim aFile As String
Dim sMsg As String
aFile = "c:\data.txt"
iNumber = Freefile
Open aFile For Output As #iNumber
Print #iNumber, "This is a line of text"
Print #iNumber, "This is another line of text"
Close #iNumber
iNumber = Freefile
Open aFile For Input As iNumber
While Not EOF(iNumber)
Line Input #iNumber, sLine
If sLine <>"" Then
sMsg = sMsg & sLine & chr(13)
End If
Wend
Close #iNumber
MsgBox sMsg
End Sub