asp: how to read, write file?
Website Design
Website Promotion
Graphic Design
Programming
Free Software
Computer Tips
Discount Stores
|
This site provides users with the information about asp, read file, write file, how to read files, how to write files, and more.
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
% >
|