Results 1 to 2 of 2

Thread: Backwards

  1. #1
    Join Date
    Dec 1969

    Default Backwards

    I Am Trying To Dispaly The Contents Of A Text File. When i Try To Do It Everything Is Showed Bottom To Top. The Code Is As Follows:<BR><BR>response.write("textArea Name = FileContents rows = 15 cols = 50 wrap = virtual&#062;")<BR>Set AFileObject = Server.CreateObject("Scripting.FileSystemObject")< BR>Set MyTextFile = AFileObject.OpenTextFile(Folder & "\" & File)<BR>While Not MyTextFile.AtEndOfStream<BR>NewLineOfCode = replace(MyTextFile.ReadLine,chr(13),chr(13))<BR>Li neOfCode = NewLineOfCode & LineOfCode <BR>Wend<BR>MyTextFile.Close<BR>response.write(Lin eOfCode)<BR>response.write("&#060;/TextArea&#062;")<BR><BR>Thanks In Advance, <BR>Matt<BR><BR>P.S. If You Don&#039t Understand What I Am Asking Run The Script.

  2. #2
    Join Date
    Dec 1969

    Default RE: Backwards

    Okay, Matt. Think about it.<BR><BR>stuff = " first stuff"<BR>more = " and more stuff"<BR>result = more & stuff<BR><BR>What would you *EXPECT* to see for result???<BR><BR>I *hope* you would expect to see<BR><BR>" and more stuff first stuff"<BR><BR>because that&#039s the order you asked for!<BR><BR>NOW...<BR><BR>HOW is that different than your line:<BR><BR>LineOfCode = NewLineOfCode & LineOfCode <BR><BR>ANSWER: IT IS NOT DIFFERENT!<BR><BR>You screwed up. You should have done:<BR><BR>LineOfCode = LineOfCode & NewLineOfCode <BR><BR>***************<BR><BR>Aside from that...<BR><BR>What do you expect this line to do:<BR><BR>NewLineOfCode = replace(MyTextFile.ReadLine,chr(13),chr(13))<BR><B R>???<BR><BR>You are asking it to replace the funny character chr(13) with...uuuhhhh...ummmm....chr(13)???<BR><BR>Like if I take "ABACAD" and replace every "A" with "A" I end up with...ummmm...<BR><BR>I *think* you meant to do<BR><BR>NewLineOfCode = replace(MyTextFile.ReadLine,chr(13),"&LT;BR&#062;" & chr(13))<BR><BR>But you do NOT need to do that! Better to simply tack the &LT;BR&#062; onto the end of each line:<BR><BR>While Not MyTextFile.AtEndOfStream<BR>&nbsp;&nbsp;&nbsp;&nbs p;LineOfCode = LineOfCode & MyTextFile.ReadLine & "&LT;BR&#062;" & vbNewLine<BR>Wend<BR><BR>***********<BR><BR>Give it a shot!<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts