Example - Write # Statement

  1. Sub Main ()

    1. Open "TESTFILE" For Output As #1          ' Open to write file.

      userData1$ = InputBox ("Enter your own text here")

      userData2$ = InputBox ("Enter more of your own text here")

      Write #1, "This is a test of the Write # statement."

      Write #1,userData1$, userData2

      Close #1

      Open "TESTFILE" for Input As #2          ' Open to read file.

      Do While Not EOF(2)

      1. Line Input #2, FileData          ' Read a line of data.

        PRint FileData         ' Construct message.

      Loop

      Close #2 ' Close all open files.

      MsgBox "Testing Print Statement"          ' Display message.

      Kill "TESTFILE"          ' Remove file from disk.

    End Sub