Column

(PWS4 IIS4 IIS5)
Column — TextStream ファイル内での現在の文字位置のカラム番号を返します。値の取得のみ可能です。

構文

object.Column

パラメータ

object
TextStream オブジェクトを指定します。

戻り値

現在のカラムの位置を返します。
現在の位置が行の先頭から何文字目かを示します。

説明

改行を書き込んだ後、ほかの文字を一切書き込んでいない状態での Column プロパティの値は 1 です。

JScript

1
2
3
4
5
6
7
8
9
10
11
12
function GetColumn()
{
   var fso, f, m;
   var ForReading = 1, ForWriting = 2;
   fso = new ActiveXObject("Scripting.FileSystemObject");
   f = fso.OpenTextFile("c:\\testfile.txt", ForWriting, true);
   f.Write("Hello World!");
   f.Close();
   f = fso.OpenTextFile("c:\\testfile.txt", ForReading);
   m = f.ReadLine();
   return(f.Column);
}

VBScript

1
2
3
4
5
6
7
8
9
10
11
Function GetColumn
   Const ForReading = 1, ForWriting = 2
   Dim fso, f, m
   Set fso = CreateObject("Scripting.FileSystemObject")
   Set f = fso.OpenTextFile("c:\testfile.txt", ForWriting, True)
   f.Write "Hello world!"
   f.Close
   Set f = fso.OpenTextFile("c:\testfile.txt", ForReading)
   m =   f.ReadLine
   GetColumn = f.Column
End Function

関連ページ