PDA

Click to See Complete Forum and Search --> : Complete asp newby question.


Crypt
Aug 8th, 2000, 04:45 AM
I've never really touched asp before never really needed it, but I've just a couple of questions about it.

first how can you open a text file for append in asp and add a line to it? and if the file does not exist it will be created?

second how do you open a text in asp for just output and write a line to it? and again if the file does not exist will it be created?.

thanx for any help.

Ianpbaker
Aug 8th, 2000, 05:37 AM
Hi Crypt

you need to use the scripting object to do what you need.
first create your file system object by using

Set fs = CreateObject("Scripting.FileSystemObject")

Then set up your file object by using this

Set readfile=fs.OpenTextFile(filename,1,False)

The last paramater is used for if you want a file created if it can't find one in the specified filename.

then finally, use either readfile.readline to get a line of information or readfile.writeline to write a line. there is also other ones as well se here for more information

http://msdn.microsoft.com/scripting/default.htm?/scripting/vbscript/doc/vsmthreadline.htm

Hope this helps

Ian

Crypt
Aug 8th, 2000, 09:52 PM
thanx for the info, but one question about pws if someone can answer, I have it on my win98 cd but haven't installed it yet, but I heard you could test out asp with it so I think I will, but how do you test asp with it? just have it running and then open a webpage? or do you have to run the webpage from a certain path? or do you have to open it up in personal webserver or something?

thanx again.

noone
Aug 8th, 2000, 11:06 PM
You have to put the ASP page in a directory that allows scripts to run.
Then in your webbrowser you would type something like:
http://localhost/mydir/myfile.asp
or
http://127.0.0.1/mydir/myfile.asp
or
http://myip/mydir/myfile.asp