![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Newbie
Join Date: Feb 2005
Posts: 3
Rep Power: 0
![]() |
Deleting and writing over lines in VB6
For a program in class, I need to be able to search for a string in a text file (one word per line) and be able to either delete it or write over it, depending on what the user chooses. I can check for a match, but I don't know how to write over the line or delete it once i've found it. Any help is appreciated. i'll provide more info if needed.
Thanks, ---ae
__________________
Shameless Plug |
|
|
|
|
|
#2 |
|
Programming Guru
![]() ![]() |
Here's a little pseudo code for ya for a function:
open text file then loop with a while not eof loop check string read in from text file against compairison string. if string == string then if userchoice == delete delete line and text so that there is no white space. elseif userchoice == overwirte Over write string with what ever the user wants. end if end if end while loop close text file end function.
__________________
Profanity is the one language that all programmers understand. Check out my Blog <---updated Nov 30 2007! |
|
|
|
|
|
#3 |
|
Expert Programmer
|
I hate the way sequential, and transaction file methods are drummed into students heads by teachers who learned to program in the 1970s.
The line-by-line concept was only adopted because that was how printers used to work. Nowadays files do not have to be organised by line breaks - just try parsing SGML in that way! Using a couple of well placed mids and replaces should do the trick, just search between vbcrlf's |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|