Collabora Office 24.04 Help
μ΄λ¦° μμ°¨ νμΌμμ λ°μ΄ν°λ₯Ό μ½μ΅λλ€.
Input #fileNum {,|;} var1 [, var2 [, ...]]
fileNum: Number of the file that contains the data that you want to read. The file must be opened with the Open statement using the key word INPUT.
var: A numeric or string variable that you assign the values read from the opened file to.
Input# λ¬Έμ μ΄λ¦° νμΌμμ μ«μ κ° λλ λ¬Έμμ΄μ μ½μ λ€μ λ°μ΄ν°λ₯Ό νλ μ΄μμ λ³μμ ν λΉν©λλ€. μ«μ λ³μλ 첫 λ²μ§Έ μΊλ¦¬μ§ 리ν΄(Asc=13), μ€ λ°κΏ(Asc=10), 곡백 λλ μΌνκΉμ§ μ½μ΅λλ€. λ¬Έμμ΄ λ³μλ 첫 λ²μ§Έ μΊλ¦¬μ§ 리ν΄(Asc=13), μ€ λ°κΏ(Asc=10) λλ μΌνκΉμ§ μ½μ΅λλ€.
μ΄λ¦° νμΌμ λ°μ΄ν° λ° λ°μ΄ν° νμμ "var" λ§€κ° λ³μμμ μ λ¬λλ λ³μμ λμΌν μμλ‘ λνλμΌ ν©λλ€. μ«μκ° μλ κ°μ μ«μ λ³μμ ν λΉν κ²½μ° "var"μ κ° "0"μ΄ ν λΉλ©λλ€.
μΌνλ‘ κ΅¬λΆλ λ μ½λλ λ¬Έμμ΄ λ³μμ ν λΉν μ μμ΅λλ€. λν νμΌμ λ°μ΄ν(")λ 무μλ©λλ€. μ΄λ¬ν λ¬Έμλ₯Ό νμΌμμ μ½μΌλ €λ©΄ Line Input# λ¬Έμ μ¬μ©νμ¬ μΈμ κ°λ₯ λ¬Έμλ§ ν¬ν¨λ μμ ν μ€νΈ νμΌμ μ€ λ¨μλ‘ μ½μ΅λλ€.
λ°μ΄ν° μμλ₯Ό μ½λ λμ νμΌ λμ λλ¬ν κ²½μ° μ€λ₯κ° λ°μνκ³ νλ‘μΈμ€κ° μ€λ¨λ©λλ€.
Sub ExampleWorkWithAFile
Dim iCount As Integer, sFileName As String
Dim sName As String, sValue As Integer
sFileName = "C:\Users\ThisUser\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
' Read data file using Input
iCount = Freefile
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