If you think that this site is helpful, please recommend your friends to visit our site.
How to read, write file?
The following is the code to read file and write file:
1. How to read file?
-------------------------------------------------------------------------------- < % Set fs = CreateObject("Scripting.FileSystemObject") filename=server.mappath("/wwwroot/filetest.txt") Set readfile=fs.OpenTextFile(filename,1,False) Do until readfile.AtEndOfStream Text=readfile.readline response.write Text Loop readfile.close set readfile=nothing % > -------------------------------------------------------------------------------- 2. How to write file? -------------------------------------------------------------------------------- < % set oFS = server.createobject("Scripting.FileSystemObject") filename=server.mappath("/wwwroot/filetest.txt") Set readfile=fs.OpenTextFile(filename,1,False) readfile.Write "Contents" readfile.Close set readfile = nothing set oFS = nothing % >
No comments:
Post a Comment