⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 asp_ref_textstream.asp@output=print

📁 W3Schools tutorial..web designing
💻 ASP@OUTPUT=PRINT
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-US" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
<head>

<title>ASP TextStream Object</title>
 
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="Keywords" content="xml,tutorial,html,dhtml,css,xsl,xhtml,javascript,asp,ado,vbscript,dom,sql,colors,soap,php,authoring,programming,training,learning,beginner's guide,primer,lessons,school,howto,reference,examples,samples,source code,tags,demos,tips,links,FAQ,tag list,forms,frames,color table,w3c,cascading style sheets,active server pages,dynamic html,internet,database,development,Web building,Webmaster,html guide" />

<meta name="Description" content="Free HTML XHTML CSS JavaScript DHTML XML DOM XSL XSLT RSS AJAX ASP ADO PHP SQL tutorials, references, examples for web building." />

<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />

<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "../../https@ssl./default.htm" : "../../www./default.htm");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-3855518-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>

</head>
<body>

<p>From <b>http://www.w3schools.com</b> (Copyright Refsnes Data)</p>

<h1>ASP TextStream Object</h1>
<a href="asp_ref_filesystem.asp"><img border="0" alt="previous" src="../images/btn_previous.gif" width="100" height="20" /></a>
 <a href="asp_ref_drive.asp"><img border="0" alt="next" src="../images/btn_next.gif" width="100" height="20" /></a>
<hr />

<p class="intro">The TextStream object is used to access the contents of a text file.</p>

<hr />

<h2>Examples</h2>
<p><a target="_blank" href="showasp.asp@filename=demo_readtextfile">Read textfile</a><br />
This example demonstrates how to use the OpenTextFile method of the FileSystemObject
to create a&nbsp;TextStream Object. The ReadAll method of the TextStream Object
reads from the opened text file.&nbsp;&nbsp;</p>
<p><a target="_blank" href="showasp.asp@filename=demo_readpartoftextfile">Read only a part of&nbsp;
a textfile</a><br />
This example demonstrates how to only read a part of a TextStream file.</p>
<p><a target="_blank" href="showasp.asp@filename=demo_readline">Read one line of a textfile</a><br />
This example demonstrates how to read one line from a TextStream file.</p>
<p><a target="_blank" href="showasp.asp@filename=demo_readlines">Read all lines from a textfile</a><br />
This example demonstrates how to read all the lines from a TextStream file.</p>
<p><a target="_blank" href="showasp.asp@filename=demo_skip">Skip a part of a textfile</a><br />
This example demonstrates how to skip a specified number of characters when
reading the TextStream file.</p>
<p><a target="_blank" href="showasp.asp@filename=demo_skipline">Skip a line of a textfile</a><br />
This example demonstrates how to skip a line when reading the TextStream file.</p>
<p><a target="_blank" href="showasp.asp@filename=demo_line">Return line-number</a><br />
This example demonstrates how to return the current line number in a TextStream
file.</p>
<p><a target="_blank" href="showasp.asp@filename=demo_column">Get column number</a><br />
This example demonstrates how to get the column number of the current character in a
      file.</p>
<hr />

<h2>The TextStream Object</h2>
<p>The TextStream object is used to access the contents of text files.</p>

<p>The following code creates a text file (c:\test.txt) and then writes some text
to the file (the variable f is an instance of the TextStream object):</p>
<table class="ex" cellspacing="0" border="1" width="100%" cellpadding="3">
  <tr valign="top">
    <td valign="top"><pre>&lt;%&nbsp;
dim fs, f&nbsp;
set fs=Server.CreateObject(&quot;Scripting.FileSystemObject&quot;)&nbsp;
set f=fs.CreateTextFile(&quot;c:\test.txt&quot;,true)&nbsp;
f.WriteLine(&quot;Hello World!&quot;)
f.Close
set f=nothing
set fs=nothing
%></pre>
    </td>
  </tr>
</table>

<p>To create an instance of the TextStream object you can use the CreateTextFile or OpenTextFile methods of the FileSystemObject object,
or you can use the OpenAsTextStream method of the File object.<p>The TextStream object's properties and methods are described below:</p>
<h3>Properties</h3>
<table class="ex" cellspacing="0" border="1" width="100%" cellpadding="3">
  <tr valign="top">
    <th width="25%" align="left" valign="top">Property</th>
    <th width="75%" align="left" valign="top">Description</th>
  </tr>
  <tr valign="top">
    <td valign="top"><a href="prop_atendofline.asp">AtEndOfLine</a></td>
    <td valign="top">Returns true if the file pointer is positioned immediately
      before the end-of-line marker in a TextStream file, and false if not</td>
  </tr>
  <tr valign="top">
    <td valign="top"><a href="prop_atendofstream.asp">AtEndOfStream</a></td>
    <td valign="top">Returns true if the file pointer is at the end of a
      TextStream file, and false if not</td>
  </tr>
  <tr>
    <td valign="top"><a href="prop_column.asp">Column</a></td>
    <td valign="top">Returns the column number of the current character position
      in an input stream</td>
  </tr>
  <tr>
    <td valign="top"><a href="prop_line.asp">Line</a></td>
    <td valign="top">Returns the current line number in a TextStream file</td>
  </tr>
</table>

<h3>Methods</h3>

<table class="ex" cellspacing="0" border="1" width="100%" cellpadding="3">
  <tr valign="top">
    <th width="25%" align="left" valign="top">Method</th>
    <th width="75%" align="left" valign="top">Description</th>
  </tr>
  <tr valign="top">
    <td valign="top"><a href="met_close.asp">Close</a></td>
    <td valign="top">Closes an open TextStream file</td>
  </tr>
  <tr valign="top">
    <td valign="top"><a href="met_read.asp">Read</a></td>
    <td valign="top">Reads a specified number of characters from a TextStream
      file and returns the result</td>
  </tr>
  <tr valign="top">
    <td valign="top"><a href="met_readall.asp">ReadAll</a></td>
    <td valign="top">Reads an entire TextStream file and returns the result</td>
  </tr>
  <tr valign="top">
    <td valign="top"><a href="met_readline.asp">ReadLine</a></td>
    <td valign="top">Reads one line from a TextStream file and returns the result</td>
  </tr>
  <tr valign="top">
    <td valign="top"><a href="met_skip.asp">Skip</a></td>
    <td valign="top">Skips a specified number of characters when reading a TextStream file</td>
  </tr>
  <tr valign="top">
    <td valign="top"><a href="met_skipline.asp">SkipLine</a></td>
    <td valign="top">Skips the next line when reading a TextStream file</td>
  </tr>
  <tr valign="top">
    <td valign="top"><a href="met_write.asp">Write</a></td>
    <td valign="top">Writes a specified text to a TextStream file</td>
  </tr>
  <tr valign="top">
    <td valign="top"><a href="met_writeline.asp">WriteLine</a></td>
    <td valign="top">Writes a specified text and a new-line character to a TextStream file</td>
  </tr>
  <tr valign="top">
    <td valign="top"><a href="met_writeblanklines.asp">WriteBlankLines</a></td>
    <td valign="top">Writes a specified number of new-line character to a TextStream file</td>
  </tr>
</table>

<br />
<hr />
<a href="asp_ref_filesystem.asp"><img border="0" alt="previous" src="../images/btn_previous.gif" width="100" height="20" /></a>
 <a href="asp_ref_drive.asp"><img border="0" alt="next" src="../images/btn_next.gif" width="100" height="20" /></a>

<p>From <b>http://www.w3schools.com</b> (Copyright Refsnes Data)</p>

</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -