分享

请教ASP中如何读取.dat的文件?

 张青 2006-05-24
 
以文本方式查看主题

-  我的帮助论坛(主要探讨 VFP 及其它编程技术)  (http://www./bbs/index.asp)
--  CGI、ASP、JAVA论坛  (http://www./bbs/list.asp?boardid=8)
----  请教ASP中如何读取.dat的文件?  (http://www./bbs/dispbbs.asp?boardid=8&id=200853)

--  作者:pangcg
--  发布时间:2003-4-2 11:29:00

--  请教ASP中如何读取.dat的文件?
请教各位大虾,ASP中如何读取.dat的文件?
--  作者:初级VFP
--  发布时间:2003-4-2 22:44:00

--  
<%
\‘以下为读取一行
Function file_Getword(filename)
Dim fileobj,thisfile
set fileobj=createobject("scripting.filesystemobject")
set thisfile=fileobj.opentextfile(updatefile,1,false)
file_Getword=thisfile.readline
thisfile.close
set fileobj=nothing
end function
response.write "文件内容:"&file_Getword(filename)

\‘以下为读取整个文件
dim fname,FS,FGetfile,Readfile,Cstr
fname="路径+文件"
Set FS = Server.CreateObject("Scripting.FileSystemObject")
Set FGetfile = FS.Getfile(fname)
Set Readfile = FGetfile.OpenAsTextStream(1,0)
Cstr=""
Do while Readfile.AtEndOfLine<>True
Cstr=Cstr&Readfile.ReadLine&chr(13)&chr(10)
Loop
Readfile.close
set FGetfile = nothing
set Readfile = nothing
Set FS = nothing
response.write Cstr
%>


    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多