|
-
TextfileStream
I am trying to set up more than one textfilestream object in my project.
Here's the first time I declare and do it:
Dim fso2 As Variant, fs2 As Variant, a2 As Variant, txtsTextStream2 As
Variant 'input file variables
Dim strLineofProjectFile As String
Set fs2 = CreateObject("Scripting.FileSystemObject") 'set up object
Set a2 = fs2.GetFile(strProjectFileName) 'open file
Set txtsTextStream2 = a2.openastextstream(1) 'open file for reading (1)
Do Until txtsTextStream2.AtEndOfStream
'read the file line by line
strLineofProjectFile = txtsTextStream2.Readline
Later on, this code does NOT work, but it used to (before I added the code
above). It exists in a different function. Why could it be that this code
does not work?
Dim fs As Variant, a As Variant, txtsTextStream As Variant 'input file
variables
Dim strText As String
' strText - The string containing the code that may contain Trans
Dim fso As Variant, OtherFile As Variant 'output file variables
Set fso = CreateObject("Scripting.FileSystemObject")
'create file object
Set fs = CreateObject("Scripting.FileSystemObject") 'set up object
Set a = fs.OpenTextFile(strFileName, 1, False) 'open file ( 1 = ForReading)
Set txtsTextStream = a.openastextstream(1) 'open file for reading (1)
Set OtherFile = fso.CreateTextFile(strFileName, True)
'open file stream to write
'loop through file until end of file
Do Until txtsTextStream.AtEndOfStream 'WHY IS THIS ALWAYS TRUE NOW????????????????????????????????????????
'read the file line by line
strText = txtsTextStream.Readline
OtherFile.writeline (ParseLine(strText)) 'write to file
Loop
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
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks