Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 text line removal
Index -> Programming, Visual Basic and Other Basics -> Visual Basic Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
diqua




PostPosted: 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
Sponsor
Sponsor
Sponsor
sponsor
betaflye




PostPosted: Tue May 17, 2005 6:42 pm   Post subject: (No 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
Display posts from previous:   
   Index -> Programming, Visual Basic and Other Basics -> Visual Basic Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: