|
-
Jul 4th, 2000, 03:51 PM
#1
Thread Starter
Junior Member
yea i am new to asp... but i was wondering if i could make a text file or something filled with html code, and have the ASP file read it line by line and write it and display it... or do i have to make a database, cause i am too lazy for that.
-
Jul 4th, 2000, 04:54 PM
#2
Addicted Member
Hi,
To make a text file use this code:
<%
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
Set File = FSO.CreateTextFile("pathtofile.txt")
File.Save
%>
To read a file line by line use:
<%
Set FSO = Server.CreateObject("Scripting.FileSystemObject")
Set File = FSO.OpenTextFile("pathtofile.txt")
Do While Not File.AtEndOfStream
sLine = File.ReadLine
Response.Write sLine
Loop
%>
If you want more examples just let me know.
-
Jul 6th, 2000, 03:10 PM
#3
Addicted Member
Reading a text file
VBsquare, how would u read a text file /ascii file like a database? Parsing the comma delimited format so that u get the results in a table format? thanks.
-
Jul 6th, 2000, 03:16 PM
#4
Member
You can use the Split function to break it into an array of strings:
strFile = Split(strFile, ",")
Then put each new string into the table
counter = ubound(strFile)
For count = 0 To counter
Response.Write "<TD>" & strFile(count) & "</TD>"
Next
At least that's basincally how I trundled through it.
-
Jul 6th, 2000, 03:19 PM
#5
Addicted Member
Reading Text File
Thanks, i'm a newbie. I will play with it. The good part is that it can be done.
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
|