---
title: "Count + FSO"
type: "forum-thread"
url: "https://www.webforum.nu/amne/asp/53889-count-fso"
topic: "ASP"
topic_url: "https://www.webforum.nu/amne/asp"
author: "Asa"
published: "2002-09-21T22:49:25.000Z"
updated: "2002-09-21T22:49:25.000Z"
replies: 0
views: 197
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/asp/53889-count-fso"
---

# Count + FSO

## #1 — Asa, 2002-09-21T22:49Z

Har denna kod.Men vill att bara 500 rader skall sparas till en xtxfil. Sen ska de gamlaste raderna skrivas över.

\<!--#Include file="top.asp"--\>

\<meta http-equiv="refresh" content="10"\>
\<body\>

\<%If Not fso.FileExists(Server.MapPath("chat.txt")) Then
   Set fil = fso.CreateTextFile(Server.Mappath("chat.txt"), true)
     fil.WriteLine(Day(Now) & "/" & Month(Now) & "-" & FormatDateTime(Now,4) & " \| \<i\>\<b\>" & Session("user") & "\</b\> har loggat in\</i\>")
End If
   set fil = fso.OpenTextFile(Server.Mappath("chat.txt"), 1 )
   arrFsoLines = Split(fil.ReadAll, vbcrlf)

   For i = ubound(arrFsoLines) To 0 step -1%\>
     \<%=arrFsoLines(i)%\>\<br\>
   \<%Next

   fil.Close

If Request.QueryString("do") = "skapa" Then

   Info = Day(Now) & "/" & Month(Now) & "-" & FormatDateTime(Now,4) & " \| \<b\>" & Session("user") & "\</b\> - " & Replace(Request.Form("info"), vbcrlf, "")

   Set fso = CreateObject("Scripting.FileSystemObject")
   Set fil = fso.OpenTextFile(Server.Mappath("chat.txt"), 8 )

   fil.WriteLine(Info)

   fil.close
   Response.Redirect "mess.asp"
End If%\>

\</body\>
\</html\>

Permalänk: https://www.webforum.nu/p/53889

---

Tråden på webben: https://www.webforum.nu/amne/asp/53889-count-fso
