Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - A question about objects
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

A question about objects

 Post Reply Post Reply
Author
Ariod View Drop Down
Newbie
Newbie


Joined: 27 June 2003
Status: Offline
Points: 7
Post Options Post Options   Thanks (0) Thanks(0)   Quote Ariod Quote  Post ReplyReply Direct Link To This Post Topic: A question about objects
    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?
Back to Top
pmormr View Drop Down
Senior Member
Senior Member


Joined: 06 January 2003
Location: United States
Status: Offline
Points: 1479
Post Options Post Options   Thanks (0) Thanks(0)   Quote pmormr Quote  Post ReplyReply Direct Link To This Post 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

Back to Top
pmormr View Drop Down
Senior Member
Senior Member


Joined: 06 January 2003
Location: United States
Status: Offline
Points: 1479
Post Options Post Options   Thanks (0) Thanks(0)   Quote pmormr Quote  Post ReplyReply Direct Link To This Post 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...

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.