InputOutput

1.21 Input/Output

EOF Function

Microsoft.VisualBasic.FileSystem


EOF(filenumber)

 

filenumber required; Integer

Any valid file number

Return Value

A Boolean indicating whether the end of the file has been reached

Description

Returns a Boolean indicating whether the end of the file has been reached. Applies to files opened for binary, random, or sequential input.

FileAttr Function

Microsoft.VisualBasic.FileSystem


FileAttr(filenumber)

 

filenumber required; Integer

Any valid file number

Return Value

An OpenMode constant, as shown in the following table:

Mode

Value

Input

1

Output

2

Random

4

Append

8

Binary

32

Description

Returns the file-access mode for a file opened using the FileOpen procedure

FileClose Procedure

Microsoft.VisualBasic.FileSystem


FileClose([filenumber][, filenumber][,...])

 

filenumber optional; Integer

The file number (or numbers) of file (or files) opened using the FileOpen procedure

Description

Closes one or more files opened with the FileOpen procedure

FileGet, FileGetObject Procedures

Microsoft.VisualBasic.FileSystem


FileGet(FileNumber, Value, RecordNumber)
FileGetObject(FileNumber, Value, RecordNumber)

 

FileNumber required; Integer

Any valid file number

Value required; any (object for FileGetObject)

Variable in which to place file contents

RecordNumber optional; Integer

The location at which reading begins

Description

Copies data from a file on disk into a variable.

FileLen Function

Microsoft.VisualBasic.FileSystem


FileLen(pathname)

 

pathname required; String

The filename, along with its path and drive name (optionally)

Return Value

A Long containing the length of the specified file in bytes

Description

Specifies the length of a file on disk.

FileOpen Procedure

Microsoft.VisualBasic.FileSystem


FileOpen(filenumber, filename, mode, access, share, _
recordlength)

 

filenumber required; Integer

An available file number.

filename required; String

The name of the file to open, along with an optional path.

mode optional; OpenMode enum

The file-access mode. Options are: OpenMode.Append, OpenMode.Binary, OpenMode.Input, OpenMode.Output, or OpenMode.Random (the default value).

access optional; OpenAccess enum

Specifies the allowable operations by the current process. Options are: OpenAccess.Default, OpenAccess.Read, OpenAccess.ReadWrite (the default value), or OpenAccess.Write.

share optional; OpenShare enum

Specifies the allowable operations by other processes. Options are: OpenShare.Shared (the default value), OpenShare.LockRead, OpenShare.LockWrite, or OpenShare.LockreadWrite.

recordlength optional; Integer (at most, 32767)

The length of the record (for random access) or of the I/O buffer (for sequential access).

Description

Opens a disk file for reading and/or writing.

FilePut, FilePutObject Procedures

Microsoft.VisualBasic.FileSystem


FilePut(filenumber, value, [recordnumber])
FilePutObject(filenumber, value, [recordnumber]) 

 

filenumber required; Integer

Any valid file number

value required; any (object for FilePutObject)

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

recordnumber optional; 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.

FileWidth Procedure

Microsoft.VisualBasic.FileSystem


FileWidth(filenumber, recordwidth)

 

filenumber required; Integer

Any valid file number

recordwidth required; Numeric

A number between 0 and 255

Description

Specifies a virtual file width when working with files opened with the FileOpen function.

FreeFile Function

Microsoft.VisualBasic.FileSystem


FreeFile(  )

 

Return Value

An integer representing the next available file number

Description

Returns the next available file number for use in a FileOpen function.

Input Procedure

Microsoft.VisualBasic.FileSystem


Input(filenumber,value)

 

filenumber required; Integer

Any valid file number

value required; any

Data to read from file

Description

Reads delimited data from a file into variables. This statement is used to read files that were created using the Write procedure, in which case the items are comma delimited with quotation marks around strings.

InputString Function

Microsoft.VisualBasic.FileSystem


InputString(filenumber, charcount)

 

filenumber required; Integer

Any valid file number

charcount required; Integer

Number of characters to read from file

Return Value

A String containing charcount characters

Description

Reads data from a file into a string variable.

LineInput Function

Microsoft.VisualBasic.FileSystem


LineInput(filenumber)

 

filenumber required; Integer

Any valid file number

Return Value

A String containing the line read from the file

Description

Assigns a single line from a sequential file opened in Input mode to a string variable.

Loc Function

Microsoft.VisualBasic.FileSystem


Loc(filenumber)

 

filenumber required; Integer

Any valid file number

Return Value

A Long indicating the current position of the read/write pointer in a file

Description

Determines the current position of the file read/write pointer.

Lock Procedure

Microsoft.VisualBasic.FileSystem


Lock(filenumber[, record])  Syntax 1.
Lock(filenumber[, fromrecord,torecord]  Syntax 2.

 

filenumber required; Integer

Any valid file number

record optional; Long

The record or byte number at which to commence the lock

fromrecord optional; Long

The first record or byte number to lock

torecord optional; Long

The last record or byte number to lock

Description

The Lock procedure prevents another process from accessing a record, section, or whole file until it is unlocked by the Unlock function.

Use the Lock procedure in situations where multiple programs or more than one instance of your program may need read and write access to the same data file.

LOF Function

Microsoft.VisualBasic.FileSystem


LOF(filenumber)

 

filenumber required; Integer

Any valid file number

Return Value

Long Integer

Description

Returns the size of an open file in bytes.

Print, PrintLine Procedures

Microsoft.VisualBasic.FileSystem


Print(filenumber, [outputlist(  )])
PrintLine(filenumber, [outputlist(  )])

 

filenumber required; Integer

Any valid file number.

outputlist optional; Parameter Array

A comma-separated list of expressions to output to a file. outputlist can be either a scalar variable, a list of comma-delimited expressions, or a parameter array. Its comma-delimited expressions or parameter array can include the following:

Spc (n) optional

Insert n space characters before expression.

Tab (n) optional

Position the insertion point either at the next print zone (by omitting n) or at column number (n).

expression optional; any

The data expression to output.

Description

Outputs formatted data to a disk file opened for Append or Output

Reset Procedure

Microsoft.VisualBasic.FileSystem


Reset(  )

 

Description

Closes all files that have been opened using the FileOpen procedure.

Seek Function

Microsoft.VisualBasic.FileSystem


Seek(filenumber)

 

filenumber required; Integer

Any valid file number

Return Value

A Long indicating the current read/write position

Description

Returns the current position of the read/write marker in the open file filenumber.

Seek Procedure

Microsoft.VisualBasic.FileSystem


Seek(filenumber, position)

 

filenumber required; Integer

Any valid file number

position required; Long

Any whole number between 1 and 2,147,483,647

Description

Places the read/write marker at a given position where the next read/write operation should occur.

Spc Function

Microsoft.VisualBasic.FileSystem


Spc(n)

 

n required; Integer

The number of spaces required

Return Value

A String containing n spaces

Description

Inserts spaces between expressions in a Print or PrintLine procedure.

Tab Function

Microsoft.VisualBasic.FileSystem


Tab[(column)]

 

column optional; Short

A column number to which the insertion point will move before displaying or printing the next expression

Return Value

A TabInfo structure

Description

Moves the text-insertion point to a given column or to the start of the next print zone.

 



VB. NET Language Pocket Reference
VB.NET Language Pocket Reference
ISBN: 0596004281
EAN: 2147483647
Year: 2002
Pages: 31

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