Write Statement

๋ฐ์ดํ„ฐ๋ฅผ ์ˆœ์ฐจ ํŒŒ์ผ์— ๊ธฐ๋กํ•ฉ๋‹ˆ๋‹ค.

๊ตฌ๋ฌธ:


Write [#FileName], [Expressionlist]

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

FileName: ๊ฐ ํŒŒ์ผ์— ๋Œ€ํ•ด Open ๋ฌธ์œผ๋กœ ์„ค์ •๋œ ํŒŒ์ผ ๋ฒˆํ˜ธ๋ฅผ ํฌํ•จํ•˜๋Š” ์ž„์˜์˜ ์ˆซ์ž ์‹์ž…๋‹ˆ๋‹ค.

Expressionlist: ํŒŒ์ผ์— ์ž…๋ ฅํ•  ์‰ผํ‘œ๋กœ ๊ตฌ๋ถ„๋œ ๋ณ€์ˆ˜ ๋˜๋Š” ์‹์ž…๋‹ˆ๋‹ค.

ํ‘œํ˜„์‹ ๋ชฉ๋ก์ด ์ƒ๋žต๋œ ๊ฒฝ์šฐ Write ๋ฌธ์€ ํŒŒ์ผ์— ๋นˆ ์ค„์„ ์ถ”๊ฐ€ํ•ฉ๋‹ˆ๋‹ค.

์‹ ๋ชฉ๋ก์„ ์ƒˆ ํŒŒ์ผ์ด๋‚˜ ๊ธฐ์กด ํŒŒ์ผ์— ์ถ”๊ฐ€ํ•˜๋ ค๋ฉด ํŒŒ์ผ์„ Output ๋˜๋Š” Append ๋ชจ๋“œ๋กœ ์—ด์–ด์•ผ ํ•ฉ๋‹ˆ๋‹ค.

์ž‘์„ฑํ•˜๋Š” ๋ฌธ์ž์—ด์€ ๋”ฐ์˜ดํ‘œ๋กœ ๋ฌถ์ด๊ณ  ์‰ผํ‘œ๋กœ ๊ตฌ๋ถ„๋ฉ๋‹ˆ๋‹ค. ํ‘œํ˜„์‹ ๋ชฉ๋ก์— ์ด ๊ตฌ๋ถ„ ๊ธฐํ˜ธ๋ฅผ ์ž…๋ ฅํ•  ํ•„์š”๋Š” ์—†์Šต๋‹ˆ๋‹ค.

๊ฐ Write ๋ฌธ์—๋Š” ๋งˆ์ง€๋ง‰ ํ•ญ๋ชฉ์œผ๋กœ ์ค„ ๋ ๊ธฐํ˜ธ๊ฐ€ ์ถœ๋ ฅ๋ฉ๋‹ˆ๋‹ค.

์†Œ์ˆ˜์ ์„ ๊ฐ–๋Š” ์ˆ˜๋Š” ๊ตญ๊ฐ€๋ณ„ ์„ค์ •์— ๋”ฐ๋ผ ๋ณ€ํ™˜๋ฉ๋‹ˆ๋‹ค.

์˜ˆ:


Sub ExampleWrite
Dim iCount As Integer
Dim sValue As String
    iCount = Freefile
    Open "C:\data.txt" For Output As iCount
    sValue = "Hamburg"
    Write #iCount,sValue,200
    sValue = "New York"
    Write #iCount,sValue,300
    sValue = "Miami"
    Write #iCount,sValue,450
    Close #iCount
End Sub

Please support us!