#1
  1. No Profile Picture
    Steve Schofield
    Guest
    ASP Mastermind (5000+ posts)

    Display content of text file


    <i><b>Originally posted by : Norli (norli@jic.net.my)</b></i><br />Hi all,<br /><br />I found the following script for reading contents from a text file and display..<br /><br /> Set fso = CreateObject("Scripting.FileSystemObject")<br /> Set f = fso.OpenTextFile("D:InetPubwwwrootNollytest est1.txt", ForReading, True)<br /> <br /> DO WHILE NOT f.AtEndOfStream<br /> intLineNum = f.line<br /> strLineNum = Right("00" &Cstr(intLineNum), 3)<br /> strLineText = f.Readline<br /> Response.Write strLineNum &": " &strLineText &vbCrLf<br /><br /> LOOP<br /> f.close<br /><br />This script displays the contents exactly as it appears it the text file if I display it in a <TEXTAREA>.<br /><br />ie: Line 001: this is the first line<br /> Line 002:<br /> Line 003: this is the 3rd line<br /><br />Otherwise, it displays the contents in 1 line.<br /><br />ie. Line 001: this is the first line Line 002: Line 003: this is the 3rd line<br /><br />How can I display the contents nicely without the <TEXTAREA><br /><br />Thanks a lot!<br />
  2. #2
  3. No Profile Picture
    Steve Schofield
    Guest
    ASP Mastermind (5000+ posts)
    <i><b>Originally posted by : Adrian Forbes</b></i><br />Either use the PRE tags;<br /><br /><PRE><br /><br />now write your content<br /><br /></PRE><br /><br />Or replace all vbCRLF chars with "<br>"<br /><br />sText = "text from file"<br />response.write Replace(sText, vbCRLF, "<br>")
  4. #3
  5. No Profile Picture
    Steve Schofield
    Guest
    ASP Mastermind (5000+ posts)
    <i><b>Originally posted by : Norli (norli@jic.net.my)</b></i><br />Thanks a lot Adrian! It works!<br /><br /><br />------------<br />Adrian Forbes at 6/13/2000 5:11:06 AM<br /><br />Either use the PRE tags;<br /><br /><PRE><br /><br />now write your content<br /><br /></PRE><br /><br />Or replace all vbCRLF chars with "<br>"<br /><br />sText = "text from file"<br />response.write Replace(sText, vbCRLF, "<br>")

Similar Threads

  1. How do I close a text file?
    By jl39775 in forum .NET Development
    Replies: 1
    Last Post: May 13th, 2003, 09:17 PM
  2. Web serverístatistical analysis
    By cso in forum ASP Development
    Replies: 0
    Last Post: April 19th, 2003, 11:35 AM
  3. Reading a text file
    By Steve Schofield in forum ASP Development
    Replies: 1
    Last Post: February 2nd, 2002, 01:09 AM
  4. Display contents of Text File
    By Steve Schofield in forum ASP Development
    Replies: 1
    Last Post: September 22nd, 2001, 06:06 AM
  5. How can i display the content of the text file from a ADO?
    By Steve Schofield in forum SQL Development
    Replies: 0
    Last Post: December 12th, 2000, 02:31 AM

IMN logo majestic logo threadwatch logo seochat tools logo