|
-
Nov 9th, 1999, 08:05 AM
#1
Thread Starter
Member
I'm having a rough time with file I/O.
I have a file with data delimited by newlines.
I want to be able to search through the data for a matching string, and then remove it.
Also, is there a way to specify what line to start on? in case i wanted to make something that could advance through all this data one at a time, and the user could change a specific entry?
Any help would be greatly appreciated. Thanks.
~Falc
-
Nov 9th, 1999, 04:05 PM
#2
Addicted Member
I think you need
1. open your file and to search for a line
2. create new file and to copy data which to you are necessary
3. delete first file and rename second file
------------------
smalig
[email protected]
smalig.tripod.com
-
Nov 9th, 1999, 07:47 PM
#3
Hyperactive Member
Check out this tutorial here on VB-World.
It searches thru a word dokument for specific values and changes them or remove them.
It might not be exactly what you are talking about, but maybe it will help you in the right direction http://www.vb-world.net/activex/wordreports/
------------------
******
Anders
[email protected]
*******
-
Nov 9th, 1999, 10:14 PM
#4
Member
You can do all of what you want with the file system object and textstream object. Add a reference to Microsoft Scripting Runtime and check out the MSDN help on working with the file system object. Here's a couple of little examples:
**Read an entire text file into a string**
Dim f as FileSystemObject
Dim ts as TextStream
Dim sTemp as String
'instantiate file system object
Set f = New FileSystemObject
'point textstream to text file
Set ts = f.OpenTextFile(pathtofile,ForReading)
'read entire file into string var
Do
sTemp = sTemp & ts.ReadLine
Loop Until ts.AtEndOfStream = True
'kill objects
ts.Close
Set ts = Nothing
Set f = Nothing
**You can use the SkipLine method of the TextStream Object to skip lines in the file**
ts.SkipLine
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
|