Sisukord

# Write# Statement

Writes data to a sequential text file with delimiting characters.

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

### Süntaks:

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

### Parameetrid:

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.

Kui jätad avaldiste loendi vahale, siis lisab lause Write failile tühja rea.

Uuele või olemasolevale failile avaldiste loendi lisamiseks peab fail olema avatud väljastus- või lisamisrežiimis.

Kirjutatud stringid pannakse jutumärkidesse ja eraldatakse komaga. Neid eraldajaid pole avaldiste loendisse vaja käsitsi sisestada.

IgaWrite-lause väljastab viimase kirjena realõpu sümboli.

Kümnenderaldajatega arvud teisendatakse vastavalt lokaadisätetele.

### Näide:

      Sub ExampleWrite
          Dim iCount As Integer
          Dim sValue As String
          iCount = Freefile
          Open "C:\Users\ThisUser\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

      Sub ExampleWrite
          Dim iCount As Integer
          Dim sValue As String
          iCount = Freefile
          Open "~/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

Sarnased teemad

Open Statement

Print# Statement

Put# Statement

Close Statement

Palun toeta meid!