Share via


FileSystem.FileWidth(Int32, Int32) 方法

定義

為藉由使用 FileOpen 函式開啟的檔案指派輸出行寬度。

public:
 static void FileWidth(int FileNumber, int RecordWidth);
public static void FileWidth (int FileNumber, int RecordWidth);
static member FileWidth : int * int -> unit
Public Sub FileWidth (FileNumber As Integer, RecordWidth As Integer)

參數

FileNumber
Int32

必要。 任何有效的檔案數目。

RecordWidth
Int32

必要。 0-255 範圍內的數值運算式 (包含頭尾),表示在開始新行之前,會有多少字元出現在一行上。 如果 RecordWidth 等於 0,則一行的長度將沒有限制。 RecordWidth 的預設值為 0。

例外狀況

檔案模式無效。

範例

此範例會使用函 FileWidth 式來設定檔案的輸出行寬度。

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.

適用於

另請參閱