Line Input # Statement

์ˆœ์ฐจ ํŒŒ์ผ์—์„œ ๋ณ€์ˆ˜๋กœ ๋ฌธ์ž์—ด์„ ์ฝ์–ด์˜ต๋‹ˆ๋‹ค.

๊ตฌ๋ฌธ:


Line Input #FileNumber As Integer, Var As String

๋งค๊ฐœ ๋ณ€์ˆ˜:

FileNumber: ์ฝ์„ ๋ฐ์ดํ„ฐ๊ฐ€ ํฌํ•จ๋œ ํŒŒ์ผ์˜ ๋ฒˆํ˜ธ์ž…๋‹ˆ๋‹ค.๋จผ์ € Open ๋ฌธ์—์„œ 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, "๋‹ค๋ฅธ ์ค„ ํ…์ŠคํŠธ์ž…๋‹ˆ๋‹ค."
    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

Please support us!