zoukankan      html  css  js  c++  java
  • ASP操作文件

    1.写数据
      fo=Server.MapPath("SFZH_MD.txt")
       set fs=Server.CreateObject("Scripting.FileSystemObject")
       set fn=fs.CreateTextFile(fo,True)
       fn.Write “DDD”
       fn.Close
      2.打开此文件,但好像只能在服务器访问才行
       fo=replace(fo,"\","\\")
       response.Write "<script >"
       response.Write "(new   ActiveXObject(""wscript.shell"")).run("""&fo&""")"
       response.write "< /script>"
    3.保存文件
    Response.clear
      fo=Server.MapPath("SFZH_MD.txt")
      Response.ContentType = "application/octet-stream"
      Response.AddHeader "Content-Disposition","attachment;filename=SFZH_MD.txt;charset=GB2312"
      Const ForReading = 1, ForWriting = 2, ForAppending = 8
      Const TristateUseDefault = -2, TristateTrue = -1, TristateFalse = 0
      Dim fso, f, ts
      Set fso = CreateObject("Scripting.FileSystemObject")
      Set f = fso.GetFile(fo)  
      Set ts = f.OpenAsTextStream(ForReading, TristateUseDefault)
      Do While ts.AtEndOfLine <> True
        Response.write(ts.ReadLine)
      Loop
      ts.Close
      set fso=nothing
  • 相关阅读:
    Hdu3022 Sum of Digits
    bzoj3864 Hero meet devil
    bzoj2448 挖油
    poj3783 Balls
    bzoj3802 Vocabulary
    Hdu5181 numbers
    Hdu5693 D Game
    图形填充之边标志算法
    图形填充之栅栏填充算法
    图形填充之种子填充算法
  • 原文地址:https://www.cnblogs.com/itecho/p/1340082.html
Copyright © 2011-2022 走看看