ASPチュートリアル

ASPホーム

WPチュートリアル

Webページの紹介 WebPages Razor Webページのレイアウト Webページフォルダ WebPages Global Webページフォーム Webページオブジェクト Webページファイル Webページデータベース Webページヘルパー WebPages WebGrid Webページチャート Webページの電子メール Webページのセキュリティ Webページの公開 Webページの例 Webページクラス

ASP.NET Razor

かみそりのイントロ かみそりの構文 Razor C#変数 Razor C#ループ Razor C#ロジック RazorVB変数 かみそりVBループ RazorVBロジック

ASPクラシック

ASPイントロ ASP構文 ASP変数 ASP手順 ASP条件文 ASPループ ASPフォーム ASPCookie ASPセッション ASPアプリケーション ASP #include ASP Global.asa ASP AJAX ASPメール ASPの例

ASPリファレンス

ASPVB関数 ASPVBキーワード ASP応答 ASPリクエスト ASPアプリケーション ASPセッション ASPサーバー ASPエラー ASPファイルシステム ASP TextStream ASPドライブ ASPファイル ASPフォルダー ASP辞書 ASP AdRotator ASP BrowserCap ASPコンテンツリンク ASPコンテンツローテーター ASPクイック参照

ADOチュートリアル

ADOイントロ ADOコネクト ADOレコードセット ADOディスプレイ ADOクエリ ADOソート ADO追加 ADOアップデート ADO削除 ADO Demo ADOスピードアップ

ADOオブジェクト

ADOコマンド ADO接続 ADOエラー ADOフィールド ADOパラメータ ADOプロパティ ADOレコード ADOレコードセット ADOストリーム ADOデータ型

ASPTextStreamオブジェクト_


TextStreamオブジェクトは、テキストファイルの内容にアクセスするために使用されます。


その他の例


テキストファイルを読むテキストファイルから読む方法


ファイルの一部のみを読み取る方法。


ファイルから1行を読み取る方法。


ファイルからすべての行を読み取る方法。


スキップするTextStreamファイルを読み取るときに指定された文字数をスキップする方法。


TextStreamファイルを読み取るときに1行をスキップする方法。


を返すTextStreamファイルで現在の行番号を返す方法。


の取得ファイル内の現在の文字の列番号を取得する方法。


TextStreamオブジェクト

TextStreamオブジェクトは、テキストファイルの内容にアクセスするために使用されます。

次のコードは、テキストファイル(c:\ test.txt)を作成してから、ファイルにテキストを書き込みます(変数fはTextStreamオブジェクトのインスタンスです)。

<%
dim fs,f
set fs=Server.CreateObject("Scripting.FileSystemObject")
set f=fs.CreateTextFile("c:\test.txt",true)
f.WriteLine("Hello World!")
f.Close
set f=nothing
set fs=nothing
%>


TextStreamオブジェクトのインスタンスを作成するには、FileSystemObjectオブジェクトのCreateTextFileメソッドまたはOpenTextFileメソッドを使用するか、FileオブジェクトのOpenAsTextStreamメソッドを使用できます。

TextStreamオブジェクトのプロパティとメソッドを以下に説明します。

プロパティ

Property Description
AtEndOfLine Returns true if the file pointer is positioned immediately before the end-of-line marker in a TextStream file, and false if not
AtEndOfStream Returns true if the file pointer is at the end of a TextStream file, and false if not
Column Returns the column number of the current character position in an input stream
Line Returns the current line number in a TextStream file

メソッド

Method Description
Close Closes an open TextStream file
Read Reads a specified number of characters from a TextStream file and returns the result
ReadAll Reads an entire TextStream file and returns the result
ReadLine Reads one line from a TextStream file and returns the result
Skip Skips a specified number of characters when reading a TextStream file
SkipLine Skips the next line when reading a TextStream file
Write Writes a specified text to a TextStream file
WriteLine Writes a specified text and a new-line character to a TextStream file
WriteBlankLines Writes a specified number of new-line character to a TextStream file