%
Option Explicit
Const Filename = "./articles.txt" ' file to read
Const ForReading = 1, ForWriting = 2, ForAppending = 3
Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
Const delim = "|"
Dim Filepath
Dim TextStream
Dim FSO
Dim strLine
dim OutStream
dim aryFields
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
Filepath = Server.MapPath(Filename)
if FSO.FileExists(Filepath) Then
Set TextStream = FSO.OpenTextFile(Filepath, ForReading, False, TristateUseDefault)
Do While Not TextStream.AtEndOfStream
strLine = TextStream.ReadLine
If strLine = "" then Exit Do
strLine = Replace(strLine, "&", "&")
strLine = Replace(strLine, "\n", "
")
aryFields = Split(strLine, delim)
OutStream = OutStream & "
" & aryFields(0) & "
" & chr(10) OutStream = OutStream & "" & aryFields(1) & "
" & chr(10) OutStream = OutStream & "
|