Input# Statement

අනුක්‍රමික ගොනුවක ඇති දත්ත කියවයි.

කාරක රීතිය:

Input #FileNumber As Integer; var1[, var2[, var3[,...]]]

පරාමිතීන්:

FileNumber: ඔබට කියවීමට අවශ්‍ය දත්ත ඇති ගොනුවේ අංකය. මෙම ගොනුව INPUT සෙවුම් පදය භාවිතයෙන් Open ප්‍රකාශනය මගින් විවෘත කිරීම අත්‍යවශ්‍යය.

var: ඔබ විවෘත කල ගොනුවෙහි ඇති දත්ත ඇතුලත් කරන සංඛ්‍යාත්මක හෝ තන්තුමය විචල්‍යය.

Input# ප්‍රකාශනය සංඛ්‍යාත්මක හෝ තන්තුමය අගයයන් විවෘත කර ඇති ගොනුවකින් කියවා, එම දත්ත, විචල්‍යයයන් එකක් හෝ කිහිපයකට ඇතුලත් කරයි. සංඛ්‍යාත්මක විචල්‍යයයන් පළමු carriage return (Asc=13), line feed (Asc=10), ඉඩ, හෝ කොමාවක් දක්වා කියවයි. තන්තුමය විචල්‍යයයන් පළමු carriage return (Asc=13), line feed (Asc=10), හෝ කොමාවක් දක්වා කියවයි.

Data and data types in the opened file must appear in the same order as the variables that are passed in the "var" parameter. If you assign non-numeric values to a numeric variable, "var" is assigned a value of "0".

Records that are separated by commas cannot be assigned to a string variable. Quotation marks (") in the file are disregarded as well. If you want to read these characters from the file, use the Line Input# statement to read pure text files (files containing only printable characters) line by line.

If the end of the file is reached while reading a data element, an error occurs and the process is aborted.

උදාහරණය:


Sub ExampleWorkWithAFile
Dim iCount As Integer
Dim sName As String
Dim sValue As Integer
Dim sFileName As String
 
sFileName = "c:\data.txt"
iCount = Freefile
 
' Write data ( which we will read later with Input ) to file
Open sFileName For Output As iCount
sName = "Hamburg"
sValue = 200
Write #iCount, sName, sValue
sName = "New York"
sValue = 300
Write #iCount, sName, sValue
sName = "Miami"
sValue = 459
Write #iCount, sName, sValue
Close #iCount
 
iCount = Freefile
' Read data file using Input
Open sFileName For Input As iCount
Input #iCount; sName, sValue
MsgBox sName & " " & sValue
Input #iCount; sName, sValue
MsgBox sName & " " & sValue
Input #iCount; sName, sValue
MsgBox sName & " " & sValue
Close #iCount
End Sub

Please support us!