Computer Science Canada

text line removal

Author:  diqua [ Thu May 12, 2005 1:35 pm ]
Post subject:  text line removal

is there a way i can remove a line from a single text file

any help will be greatly appreciated

Author:  betaflye [ Tue May 17, 2005 6:42 pm ]
Post subject: 

VB 6 or VB Classic Smile Here's some psuedo code to do what you want.

Dim iFileIn as Integer, iFileOut as Integer, strReadLine as String

iFileIn = FreeFile()
Open "Path\input.txt" for Input As #iFileIn

iFileOut = FreeFile()
Open "Path\output.txt" for Output as #iFileOut

Do while not EOF (iFileIn)
Line Input #iFileIn, strReadLine
if strReadLine <> line you want removed then
Write #iFileOut, strReadLine
end if
Loop

Kill "Path\input.txt"
Name "Path\output.txt" As "Path\input.txt

If you need a .Net example just ask Smile


: