一聚教程网:一个值得你收藏的教程网站

最新下载

热门教程

FileSystemobject组件

时间:2008-01-12 编辑:简简单单 来源:一聚教程网

该组件是负责启动文件或目录的管理,如果你象读取文件的内容,你必须配合Textstream一起用。它提供了Createtextfile,openTextFile,GetFile,GetFileName等函数。下面是一个实例:如何利用ASP在一个以有文件中添加内容
例子

<%
IF NOT Request.Form("NextLine")="" THEN
Set MyFileObject=Server.CreateObject("Scripting.FileSystemObject")
Set MyTextFile=MyFileObject.OpenTextFile("d:story.txt", 8, TRUE)
MyTextFile.WriteLine(Request.Form("NextLine"))
MyTextFile.Close
END IF
%>
>
Online Story



<%
Set MyFileObject=Server.CreateObject("Scripting.FileSystemObject")
Set MyTextFile=MyFileObject.OpenTextFile("d:story.txt")
WHILE NOT MyTextFile.AtEndOfStream
Response.Write(" "&MyTextFile.ReadLine)
WEND
MyTextFile.Close
%>


Enter a new line for the story:








热门栏目