Write, WriteLine Procedures


Write, WriteLine Procedures

Class

Microsoft.VisualBasic.FileSystem

Syntax

     Write(fileNumber, output)     WriteLine(fileNumber[, output]) 


fileNumber (required; Integer)

Any valid file number of a file opened with FileOpen


output (required for Write ; any)

A comma-delimited list of expressions, or a ParamArray, to be written to the file

Description

The Write and WriteLine procedures write data to a sequential file. The WriteLine version also appends line termination characters.

Usage at a Glance

  • output can be a ParamArray array containing values to be written to the file indicated by fileNumber.

  • The following table describes how the Write and WriteLine procedures handle certain types of data, regardless of the locale, to allow files to be read universally:

    Data type

    Data written to file

    Numeric

    Decimal separator is always written as a period (.)

    Boolean

    #TRUE# or #FALSE#

    Date

    #yyyy-mm-dd hh:mm:ss# (uses a 24-hour clock)

    Null

    #NULL#

    Error

    #ERROR errorcode#


  • The Write and WriteLine procedures automatically delimit output fields with commas and surround string data with quotation marks.

  • Data written to a file using the Write and WriteLine procedures is often read using the Input procedure.

  • If no output arguments are supplied to the WriteLine procedure, only the line termination characters are written.

  • These procedures do not support named arguments.

Version Differences

  • There are many syntactical differences between the VB 6 Write statement and the .NET Write procedure.

  • The WriteLine procedure is new with .NET as a partial replacement for the VB 6 Write statement.

  • In Visual Basic 2005, the My.Computer.FileSystem object provides more robust access to file management features.

See Also

Input Procedure, Print, PrintLine Procedures




Visual Basic 2005(c) In a Nutshell
Visual Basic 2005 in a Nutshell (In a Nutshell (OReilly))
ISBN: 059610152X
EAN: 2147483647
Year: 2004
Pages: 712

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net