Help with instream

Results 1 to 2 of 2

Thread: Help with instream

  1. #1
    Join Date
    Dec 1969

    Default Help with instream

    Hi all. <BR><BR>I&#039m trying to get an asp chat room working and I&#039m doing fine except for 1 thing. <BR><BR>When you exit the chat room it should delete the contents of the text file that stores the chat dialog. It isn&#039t and I&#039m not very familiar with how this works. The code that should do this is below. Any help would be appreciated. <BR><BR><BR> Set fileObject = Server.CreateObject("Scripting.FileSystemObject") <BR> textFile = Server.MapPath("files/" & Replace(Topic, "+", "_") & ".txt") <BR> Set inStream = fileObject.OpenTextFile(textFile,1,TRUE,FALSE) <BR> file = inStream.ReadAll <BR> Set inStream = Nothing <BR><BR> file = file & "&#060;FONT SIZE=2 FACE=&#039Arial&#039 Color=#800000&#062;&#060;b&#062;***[" & Name & " has left.]***&#060;/b&#062;&#060;/FONT&#062; <BR>" <BR> Set outStream = fileObject.CreateTextFile(textFile,True) <BR> outStream.WriteLine(file) <BR> outStream.Close <BR> Set outStream = Nothing

  2. #2
    Join Date
    Dec 1969

    Default Your complaint makes no sense.

    &nbsp;<BR><BR>You get the old contents of the file, recreate the file, and then write those same contents (with a line appended) back out to the new file!<BR><BR>So how can you even *TELL* if the old file was deleted? The new file will still contain all the contents of the old one. Your code is *probably* working fine. It just is the wrong code, apparently.<BR><BR>HOWEVER...<BR><BR>WHY in the world are you using TEXT FILES, of all things, for a chat board???? Man, if I was your ISP and caught you doing that I&#039d charge you at LEAST triple the standard amount.<BR><BR>Never heard of Application Variables? Arrays?<BR><BR>MUCH cleaner and faster solution.<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