chitika

Sunday, September 11, 2011

How to read, write file in asp?

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
% >

No comments:

Post a Comment

For other hundreds of computer repair tips, tricks, tweaks, guide, help, please go to


http://website.edusoftmax.com