Siebel VB Language Reference > Methods Reference for Siebel VB > File Input and Output Methods >

Write Data to File Method


The Write Data to File method writes data to an open sequential file. It does not return a value. You must open the file in output mode or in append mode. If you do not include the expressionList argument, then it writes a blank line to the file. For more information, see Lock File Method.

The Write statement places quotes around the string that it writes to the file.

Format

Write [#]filenumber[, expressionList]

The following table describes the arguments that you can use with this method.

Argument
Description

filenumber

The file number that the Open statement uses to open the file. For more information, see Open File Method.

expressionList

One or more values to write to the file.

Example

The following example writes a variable to a file according to a comparison of the last saved time of the file and the current time:

Sub Button_Click
   Dim tempfile
   Dim filetime, curtime
   Dim msgtext
   Dim acctno(100) as Single
   Dim x, I
   tempfile = "C:\TEMP001"
   Open tempfile For Output As #1
   filetime = FileDateTime(tempfile)
   x = 1
   I = 1
   acctno(x) = 0
   Do
      curtime = Time
      acctno(x) = 88
      If acctno(x) = 99 then
         If x = 1 then Exit Sub
         For I = 1 to x-1
            Write #1, acctno(I)
         Next I
         Exit Do
      ElseIf (Minute(filetime) + 2)< = Minute(curtime) then
         For I = I to x-1
            Write #1, acctno(I)
         Next I
      End If
      x = x + 1
   Loop
   Close #1
   x = 1
   msgtext = "Contents of C:\TEMP001 is:" & Chr(10)
   Open tempfile for Input as #1
   Do While Eof(1) <> -1
      Input #1, acctno(x)
      msgtext = msgtext & Chr(10) & acctno(x)
      x = x + 1
   Loop
   Close #1
      Kill "C:\TEMP001"
End Sub

Related Topics

Set Print Position Method

Siebel VB Language Reference Copyright © 2015, Oracle and/or its affiliates. All rights reserved. Legal Notices.