Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need help with FileSystem Object

Status
Not open for further replies.

SSJpn

Technical User
Oct 7, 2002
259
US
Hi, I am fooling around learning some ASP and the current page i have made reads a certain word from a .txt file i provide. Here is some code i got off a tutorial webpage and i just have a few questions about it

Set fsObject = Server.CreateObject _("Scripting.FileSystemObject")


Set tsObject = fsObject.OpenTextFile(XXX,1,1)

tsObject.SkipLine 'Just skip to the relevant line
tsObject.Skip(10) 'Skip to the relevant spot on the line
Do While Not tsObject.AtEndOfLine
name = name & tsObject.Read(1)
Loop

Set tsObject = nothing

Okay, first i want to know if the text file that i opened will get closed by default or if i need to write some code to close it explicitly. If i need to write some code please tell me the method that i need to use.

Also, do i also need to say 'Set fsObject = nothing'?

And lastly, exactly what does that do to say that
Set tsObject = nothing. I am familiar with C/C++ so if you could perhaps relate it to that it might help. Or if the answer is straight forward please explain what it means or does.

sorry for the long post,
but thanks in advance for any answers.
 
Set tsObject = nothing
clears this object from memory, and I believe it will close the file too.

yes -
Set fsObject = nothing

should clear all objects when done with them. the sooner the better to free up server resources.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top