Use ASP to read out text files and display

Source: Internet
Author: User
Tags readline

Use ASP to read out text files and display

Read a text file and write the Sun Aug 2 06:34:07 1998

(Note: TextStream about written method

Write (STRING)

WriteLine (STRING)

WriteBlankLines (LINES)

It's a complete program.

〈html〉

〈head〉

〈http-equiv= "Content-type" content= "text/html; charset=gb2312 "

〈title〉〈/title〉

〈/head〉

〈body〉

% LANGUAGE = VBScript%

%

Const ForReading = 1, ForWriting = 2, ForAppending = 8

Const Tristateusedefault =-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)

' The 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 in ASCII

' Format open. Tristateusedefault=-2 opens the file in the system default format,

' Tristatetrue=-1 open file or tristatefalse=0 in Unicode format

' Open the file in ASCII format.

' You 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

% >

</body>

This allows you to read and display the text file.



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.