Results 1 to 2 of 2
  1. #1
    Join Date
    May 2011
    Posts
    1

    Unanswered: FileSystemObject

    Hello,

    I am studying asp programs. In that, I have come across the following code
    which uses FileSystemObject. Can anyone help me to understand the use of
    FileSystemObject in below code?

    function CreateFile(News_Name,News_Paper,News_Matter)
    dim fs,fname
    set fs=Server.CreateObject("Scripting.FileSystemObject ")
    set fname=fs.CreateTextFile("D:\Sites\dnb_india_websit e\dnbnews\Articles\"&News_Name & "_" & News_Paper&".html",true)
    'fname.WriteLine("<pre>" & replace(news_article,"vbCrLF","<br>") & "</pre>")
    fname.WriteLine(replace(News_Matter,"vbCrLF","<br> "))
    fname.Close
    set fname=nothing
    set fs=nothing
    end function

  2. #2
    Join Date
    Dec 2008
    Posts
    10
    Not sure I understand your question, but I'll try:
    ASP does not work directly with files (e.g. open files for output, input, append, random or binary access). Instead it uses FileSystemObject and its methods to operate files on the disk.
    function CreateFile(News_Name,News_Paper,News_Matter)
    dim fs,fname
    set fs=Server.CreateObject("Scripting.FileSystemObject ") 'this line creates new FileSystemObject instance
    set fname=fs.CreateTextFile("D:\Sites\dnb_india_websit e\dnbnews\Articles\"&News_Name & "_" & News_Paper&".html",true) 'this line uses FileSystemObject to create a file
    'fname.WriteLine("<pre>" & replace(news_article,"vbCrLF","<br>") & "</pre>") ' these two lines write some contents to created file
    fname.WriteLine(replace(News_Matter,"vbCrLF","<br> "))
    fname.Close ' this line closes the created file
    set fname=nothing 'these two lines fee memory
    set fs=nothing
    end function

    I hope this helps and please forgive me if I did not understand you.

    BR,
    Faik

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •