Adding blank lines

Results 1 to 2 of 2

Thread: Adding blank lines

  1. #1
    Join Date
    Dec 1969
    Posts
    146

    Default Adding blank lines

    Hi,<BR>I have got a text file that I wish to store user and passwords in. I can write to it fine using the append command but I can&#039t get it to write to a new line each time. For example i write<BR>test&#124test as username and password then when I write again it maes it test&#124test test2&#124test2<BR>I am trying to get that next entry to write on a new line. If you can tell me the command to use please do. My script is below<BR><BR><BR><BR>&#060;%<BR>set FSO = Server.CreateObject("scripting.FileSystemObject") <BR><BR>%&#062;<BR><BR>&#060;%<BR><BR><BR>Functi on ChkString(string)<BR> if String = "" then string = " "<BR> string = replace(string, "&#039", "&#039&#039")<BR> ChkString = string<BR>End Function<BR>%&#062;<BR><BR><BR>&#060;%<BR><BR> If request.QueryString("add_user") = "true" then<BR>&#039 Declare variables for the File System Object and the File to be accessed.<BR><BR>Const ForReading = 1, ForWriting = 2, ForAppending = 3<BR>Dim objFSO, objTextFile<BR><BR>&#039 Create an instance of the the File System Object and assign it to objFSO.<BR> Set fs = CreateObject("Scripting.FileSystemObject")<BR> Set f = fs.OpenTextFile("e:TTN
    ewsletteradminusers.asp", 8)<BR><BR><BR><BR><BR>f.Write "" & ChkString(Request.Form("user")) & ""<BR>f.Write "&#124" & ChkString(Request.Form("password")) & "&#124 "<BR><BR><BR><BR><BR>%&#062;<BR>&#060;%<BR>&#0 39 Close the file.<BR>f.Close<BR><BR>&#039 Release reference to the text file.<BR>Set objTextFile = Nothing<BR><BR>&#039 Release reference to the File System Object.<BR>Set objFSO = Nothing<BR>else<BR><BR>%&#062;<BR><BR>&#060;p align="center"&#062;&#060;strong&#062;&#060;font face="veranda, Arial, Helvetica" size="3"&#062;Join Our Newsletter.&#060;/font&#062;&#060;/strong&#062;&#060;/p&#062;<BR><BR>&#060;form method="POST" action="addusers.asp?add_user=true" method="post"&#062;<BR>&#060;div align="center"&#062;&#060;center&#062;&#060;p&#062 ;<BR> &#060;input type="text" name="user" size="20"&#062;&#060;P&#062;<BR> &#060;input type="text" name="password" size="20"&#062;&#060;P&#062;<BR>&#060;input type="submit" value="Join"&#062;&#060;/p&#062;<BR> &#060;/center&#062;&#060;/div&#062;<BR>&#060;/form&#062;<BR><BR><BR><BR><BR>&#060;%<BR>End If<BR>%&#062;<BR><BR>

  2. #2
    Matthew Hazlett Guest

    Default RE: Adding blank lines

    Set fs = CreateObject("Scripting.FileSystemObject")<BR>set f = fs.OpenTextFile("whatever.txt", 8)<BR><BR>f.Write "Line #1" & vbcrlf<BR>f.Write "Line #2" & vbcrlf & vbcrlf<BR>&#039-- Blank line<BR>f.Write "Line #3" & vbcrlf<BR>f.Close<BR><BR>Set objTextFile = Nothing<BR>Set objFSO = Nothing<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
  •