home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DOS/V Power Report 1997 March
/
VPR9703A.ISO
/
MS_DEV
/
VID
/
SERVER
/
ASF
/
DATA.Z
/
ts.asp
< prev
next >
Wrap
Text File
|
1996-10-22
|
1KB
|
38 lines
<HTML>
<BODY>
<H3>Textstream test</H3>
<%
Set FileObject = Server.CreateObject("Scripting.FileSystemObject")
TestFile = Server.MapPath ("/ASPSamp") & "\samples\tsworks.txt"
Set OutStream= FileObject.CreateTextFile (TestFile, TRUE, FALSE)
OutputString = "This is a test..." & Now()
OutStream.WriteLine OutputString
Response.Write "Wrote the string '" & OutputString & "' to the file: '" & TestFile & "'<P>"
Set OutStream = Nothing
Response.Write "Reading from file '" & TestFile & "':<BR>"
Set InStream= FileObject.OpenTextFile (TestFile, 1, FALSE, FALSE)
While not InStream.AtEndOfStream
Response.Write Instream.Readline & "<BR>"
InStream.SkipLine()
wend
Set Instream=nothing
Randomize
TipNumber = Int((10 - 1 + 1) * Rnd + 1)
Response.Write "<P>The Tip Number is: " & TipNumber & "<P>"
strtipsfile = (Server.MapPath("/advworks") + "\tips.txt")
Set InStream = FileObject.OpenTextFile (strtipsfile, 1, FALSE, FALSE)
while TipNumber > 0
InStream.SkipLine()
TipNumber = TipNumber-1
wend
TipOfTheDay = Instream.ReadLine
Response.Write "The Tip of the Day is: <BR><B>" & TipOfTheDay & "</B>"
Set InStream = Nothing
%>
</BODY>
</HTML>