Click to See Complete Forum and Search --> : Scanning a file


December 26th, 1999, 11:03 PM
Hi,
I want to create an application in VB 4(16 bit) which scans a file and I will be checking for some reserved words in the file and some hard code also,if I find anything like this then I have to write this as an error in a log file(Text file). Now I really don't know like how to go about doing this in VB 4.
Now firstly I want to know which are the ways in which this can be done,should I be using MS Access or it can be done in someother way.
If anybody knows how to go about doing this or can guide me as where I can get help for this please let me know,I am eagerly waiting for some one to help me out in solving my problem.
Thanks

smalig
January 11th, 2000, 01:12 PM
Try it:

Dim sLine as String

On Error Resume Next

Open "d:\ScanFile.txt" For Input As #1
Open "d:\LogFile.txt" For Output As #2

While Not EOF(1)
Line Input #1, sLine
If instr(sLine, "reserved word")>0 Then
Print #2, "I find it."
End If
Wend

Close

Best Regards.

smalig@hotmail.com
http://vbcode.webhostme.com/