ASP reads the text file and displays

Source: Internet
Author: User
Tags readline

<title></title>
<body>
<% Langu Age = VBScript%
<%
Const ForReading = 1, ForWriting = 2, ForAppending = 8
Const TRISTAT Eusedefault =-2, TristateTrue =-1, tristatefalse = 0
Dim filename
filename = "test.txt" ' Default relative path is C:winnt
Set fs = CreateObject ("Scripting.FileSystemObject")
Set F = fs. GetFile (filename)
Set READF = F.openastextstream (forreading,tristatefalse)


' first argument is optional. Input/output mode, which is one of the following three constants:
' forreading=1 read-only, forwriting=2-writable, or forappending=3-append
' The second parameter is optional. One of three tristate values,
' indicates in what format the file is opened. Ignoring this parameter, the file is opened in ASCII
' format. Tristateusedefault=-2 open file in system default format,
' tristatetrue=-1 open file in Unicode formator Tristatefalse=0
' opens the file in ASCII format.
' can also open files using the OpenTextFile method


S = readf. ReadLine
Do While READF. AtEndOfLine <> True
s = readf. ReadLine
Response.Write S & "read the file line by row and write
Loop
readf.close
%>
</bod y>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.