| 以文本方式查看主題 - 我的幫助論壇(主要探討 VFP 及其它編程技術(shù)) (http://www.gz9f.com/bbs/index.asp) -- CGI、ASP、JAVA論壇 (http://www.gz9f.com/bbs/list.asp?boardid=8) ---- 請教ASP中如何讀取.dat的文件? (http://www.gz9f.com/bbs/dispbbs.asp?boardid=8&id=200853) |
| -- 作者:pangcg -- 發(fā)布時(shí)間:2003-4-2 11:29:00 -- 請教ASP中如何讀取.dat的文件? 請教各位大蝦,ASP中如何讀取.dat的文件? |
| -- 作者:初級VFP -- 發(fā)布時(shí)間: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) \‘以下為讀取整個(gè)文件 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 %> |
聯(lián)系客服