Write# Statement

Writes data to a sequential text file with delimiting characters.

tip

Use Print# statement to print data to a sequential text file. Use Put# statement to write data to a binary or a random file.


Syntax:

Write Statement diagram


Write [#fileNum] {,|;} expression [, …]

Parameters:

fileNum: Any numeric expression that contains the file number that was set by the Open statement for the respective file.

expression list: Variables or expressions that you want to enter in a file, separated by commas.

ν‘œν˜„μ‹ λͺ©λ‘μ΄ μƒλž΅λœ 경우 Write 문은 νŒŒμΌμ— 빈 쀄을 μΆ”κ°€ν•©λ‹ˆλ‹€.

식 λͺ©λ‘μ„ μƒˆ νŒŒμΌμ΄λ‚˜ κΈ°μ‘΄ νŒŒμΌμ— μΆ”κ°€ν•˜λ €λ©΄ νŒŒμΌμ„ Output λ˜λŠ” Append λͺ¨λ“œλ‘œ μ—΄μ–΄μ•Ό ν•©λ‹ˆλ‹€.

μž‘μ„±ν•˜λŠ” λ¬Έμžμ—΄μ€ λ”°μ˜΄ν‘œλ‘œ 묢이고 μ‰Όν‘œλ‘œ κ΅¬λΆ„λ©λ‹ˆλ‹€. ν‘œν˜„μ‹ λͺ©λ‘μ— 이 ꡬ뢄 기호λ₯Ό μž…λ ₯ν•  ν•„μš”λŠ” μ—†μŠ΅λ‹ˆλ‹€.

각 Write λ¬Έμ—λŠ” λ§ˆμ§€λ§‰ ν•­λͺ©μœΌλ‘œ 쀄 끝 κΈ°ν˜Έκ°€ 좜λ ₯λ©λ‹ˆλ‹€.

μ†Œμˆ˜μ μ„ κ°–λŠ” μˆ˜λŠ” ꡭ가별 섀정에 따라 λ³€ν™˜λ©λ‹ˆλ‹€.

Example:


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