CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2

Thread: Scanning a file

  1. #1
    Guest

    Scanning a file

    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


  2. #2
    Join Date
    Sep 1999
    Location
    Germany
    Posts
    66

    Re: Scanning a file

    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.

    [email protected]
    http://vbcode.webhostme.com/

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured