Print Page | Close Window

A question about objects

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=3882
Printed Date: 30 March 2026 at 4:29am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: A question about objects
Posted By: Ariod
Subject: A question about objects
Date Posted: 27 June 2003 at 1:45pm
I've been studying ASP for a week now, reading tutorials on the 'net, etc. But there's one thing bothering me. In the following example:

Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
Set objDat = objFSO.OpenTextFile(Server.MapPath("file.txt"), 1)

I understand that objFSO is an instance of the FileSystemObject. I also understand that OpenTextFile is a method of that object. Why am I creating another object then, objDat? Does OpenTextFile return an object? Are there any subobjects?



Replies:
Posted By: pmormr
Date Posted: 27 June 2003 at 4:15pm

objDat is an instance of a text file.  For instance you would have to type

(objFSO.OPenTextFile(Server.MapPath("file.txt"), 1)).writeline

everytime you wanted to write a line to the text file. To replace all of that you can set a variable to the objFSO.OPenTextFile(Server.MapPath("file.txt"), 1) so you don't have to type it all. so now you can say

objDat.writeline



-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/


Posted By: pmormr
Date Posted: 27 June 2003 at 4:17pm

p.s. by creating objDat you are creating an instance of a class/method/property inside the file system object. As you can see it is easier to type the one on the bottom rather than the one on the top...



-------------
Paul A Morgan

http://www.pmorganphoto.com/" rel="nofollow - http://www.pmorganphoto.com/



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net