ChrisQuick
Programmer
I have the following code for reading a textfile line by line and replacing each double quote with two, and then writing the new line to a new file.
<%
Option Explicit
Response.Buffer = True
Response.Expires = 0
Response.ExpiresAbsolute = Now() - 1
Response.CacheControl = "no-cache"
Dim objFSO
Dim ObjTextFileToRead
Dim ObjTextFileToWrite
Dim strFilename
Dim strTextLine
Const fsoForReading = 1
strFilename = "C:\Trash_Me\testin.txt"
'Create an instance of the FileSystemObject object
Set objFSO = Server.CreateObject("Scripting.FileSystemObject"
If objFSO.FileExists(strFilename) Then
On Error Resume Next
Set ObjTextFileToRead = objFSO.OpenTextFile(strFilename, fsoForReading)
If Err.Number <> 0 Then
Set ObjTextFileToRead = Nothing
Response.Write "Error Reading File"
Response.Write Err.Description
End If
Set ObjTextFileToWrite = objFSO.CreateTextFile("C:\Trash_Me\testout.txt"
While not ObjTextFileToRead.AtEndOfStream
strTextLine = ObjTextFileToRead.ReadLine
trTextLine = Replace(strTextLine, """", """"""
ObjTextFileToWrite.WriteLine("WritePretty "" " & strTextLine & " """
WEnd
' Clean Up
ObjTextFileToRead.Close
Set ObjTextFileToRead = Nothing
ObjTextFileToWrite.Close
Set ObjTextFileToWrite = Nothing
Else
Response.Write "File not found"
End If
Set objFSO = Nothing
Response.Write "Finished"
%>
When I run the code, it just seems to hang and do absolutely nothing!!! No errors, no script timeouts, nothing.
I recently installed the latest patches for windows 2000, I am now wondering if that is to blame.
Any thoughts or suggestions? cquick@callingpost.com
Geographic Information System (GIS), ASP, some Oracle
<%
Option Explicit
Response.Buffer = True
Response.Expires = 0
Response.ExpiresAbsolute = Now() - 1
Response.CacheControl = "no-cache"
Dim objFSO
Dim ObjTextFileToRead
Dim ObjTextFileToWrite
Dim strFilename
Dim strTextLine
Const fsoForReading = 1
strFilename = "C:\Trash_Me\testin.txt"
'Create an instance of the FileSystemObject object
Set objFSO = Server.CreateObject("Scripting.FileSystemObject"
If objFSO.FileExists(strFilename) Then
On Error Resume Next
Set ObjTextFileToRead = objFSO.OpenTextFile(strFilename, fsoForReading)
If Err.Number <> 0 Then
Set ObjTextFileToRead = Nothing
Response.Write "Error Reading File"
Response.Write Err.Description
End If
Set ObjTextFileToWrite = objFSO.CreateTextFile("C:\Trash_Me\testout.txt"
While not ObjTextFileToRead.AtEndOfStream
strTextLine = ObjTextFileToRead.ReadLine
trTextLine = Replace(strTextLine, """", """"""
ObjTextFileToWrite.WriteLine("WritePretty "" " & strTextLine & " """
WEnd
' Clean Up
ObjTextFileToRead.Close
Set ObjTextFileToRead = Nothing
ObjTextFileToWrite.Close
Set ObjTextFileToWrite = Nothing
Else
Response.Write "File not found"
End If
Set objFSO = Nothing
Response.Write "Finished"
%>
When I run the code, it just seems to hang and do absolutely nothing!!! No errors, no script timeouts, nothing.
I recently installed the latest patches for windows 2000, I am now wondering if that is to blame.
Any thoughts or suggestions? cquick@callingpost.com
Geographic Information System (GIS), ASP, some Oracle