FileWidth Function

Assigns an output line width to a file opened using the FileOpen function.

Public Sub FileWidth( _
   FileNumber As Integer, _
   RecordWidth As Integer _
)

Parameters

  • FileNumber
    Required. Any valid file number.

  • RecordWidth
    Required. Numeric expression in the range 0–255, inclusive, which indicates how many characters appear on a line before a new line is started. If RecordWidth equals 0, there is no limit to the length of a line. The default value for RecordWidth is 0.

Exceptions

Exception type

Error number

Condition

IOException

52

FileNumber does not exist.

IOException

54

File mode is invalid.

See the "Error number" column if you are upgrading Visual Basic 6.0 applications that use unstructured error handling. (You can compare the error number against the Number Property (Err Object).) However, when possible, you should consider replacing such error control with Structured Exception Handling Overview for Visual Basic.

Remarks

This function assigns an output line width to a file opened using the FileOpen function.

Example

This example uses the FileWidth function to set the output line width for a file.

Dim i As Integer
FileOpen(1, "TESTFILE", OpenMode.Output) ' Open file for output.
FileWidth(1, 5)   ' Set output line width to 5.
For i = 0 To 9   ' Loop 10 times.
   Print(1, Chr(48 + I))   ' Prints five characters per line.
Next
FileClose(1)   ' Close file.

Smart Device Developer Notes

This function is not supported.

Requirements

Namespace:Microsoft.VisualBasic

**Module:**FileSystem

Assembly: Visual Basic Runtime Library (in Microsoft.VisualBasic.dll)

See Also

Reference

FileOpen Function

Print, PrintLine Functions

IOException

Other Resources

File, Directory, and Drive Properties in Visual Basic