|
-
Jun 20th, 2001, 06:05 AM
#1
Reading a text file using the File System Object
Has anyone got a quick bit of code for reading the contents of a text file into a variable using the file system object?
From past experience with the fso I know I'd be able to figure it out but it's do damn fiddly that I can't be bothered if someone's already done it.
Anyone got a bit of code they can paste in for me? Don't worry if you ain't...I'll just have to do it myself the old fashioned way! 
Ta,
-
Jun 20th, 2001, 03:20 PM
#2
Lively Member
Code:
dim filesys, txtfile, line
set filesys = CreateObject("Scripting.FileSystemObject")
set txtfile = filesys.OpenTextFile("c:\file.txt",1,0)
Do
line = txtfile.ReadLine
Loop Until txtfile.AtEndOfStream
txtfile.close
This should be working. It might be Server.CreateObject... but you'll notice.
-
Jun 20th, 2001, 05:49 PM
#3
Thank you very much...
That should do me just fine... I was expecting it to involve creating more fso objects for that.. one for the folder...one for the file...one as a text stream...
I'll be putting it on an ASP page so I will be using Server.CreateObject .
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|