Name

FilePut, FilePutObject Procedures

Class

Microsoft.VisualBasic.FileSystem

Syntax

FilePut(filenumber, value, [recordnumber])

FilePutObject(filenumber, value, [recordnumber])
filenumber

Use: Required

Data Type: Integer

Any valid file number

value

Use: Required

Data Type: Any (see the first item in “Rules at a Glance”)

The name of the variable containing the data to be written to the file

recordnumber

Use: Optional

Data Type: Integer

Record number (for random access) or byte number (for binary access) at which to begin the write operation

Description

Writes data from a program variable to a disk file

Rules at a Glance

  • The value argument of the FilePut procedure can be any data type except Object. The value argument of the FilePutObject procedure must be of type Object.

  • If filenumber is opened in random access mode, recordnumber refers to the record number; if the file is opened in binary access mode, recordnumber refers to a byte number.

  • Both bytes and records in a file are numbered starting with 1.

  • If recordnumber is omitted, the next byte or record to be written will be placed at the position immediately after the position pointed to by the last FileGet or FilePut procedure, or by the last Seek function.

  • If you have opened the file in Random mode, it is important to ensure that the record length specified in the recordNumber argument of the FileOpen procedure matches the actual length of the data being written. If the length of the data being written is less than that specified by the ...

Get VB .NET Language in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.