Re: How to search files for text string most efficiently?
From: Richard Jalbert (richmann_at_sympatico.ca)
Date: 10/28/04
- Next message: Frank Liebelt: "Re: vb.net Excel versions"
- Previous message: Mythran: "__ComObject to Interface"
- In reply to: Jim: "How to search files for text string most efficiently?"
- Next in thread: Herfried K. Wagner [MVP]: "Re: How to search files for text string most efficiently?"
- Reply: Herfried K. Wagner [MVP]: "Re: How to search files for text string most efficiently?"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 28 Oct 2004 17:45:51 GMT
On Thu, 28 Oct 2004 12:24:54 -0500, "Jim" <jr@nospam.wi.rr.com> wrote:
>Hello,
>
>I am working on a small windows application for a client, and as one of the
>functions they want a search that will let them enter a search string, then
>search a directory for all flies that contain that search string AND display
>the lines that contain the search string.
>
>They have windows ME, XP and 2000 systems.
>
>Does anyone have any ideas as to the most efficient way to do this?
>
>Also, if multiple directories are chosen, should threads be used for the
>search operation?
>
>Thanks!
Personnaly I would do it this way:
Each directory would be queried so as to load all filenames in one
array (I've never done that part so...)
Then using that array, get each filename, get and read by OPEN AS
BINARY each file, loading its content in a single one string buffer,
sized after getting the file size. on which you could do a "instr"
function.
Error checking would be needed all the way through.
**********************************************************************
Richard Jalbert Programmer-Analyst Richmann@sympatico.ca
Dogs have owners, cats have staff.
http://www3.sympatico.ca/richmann/
**********************************************************************
- Next message: Frank Liebelt: "Re: vb.net Excel versions"
- Previous message: Mythran: "__ComObject to Interface"
- In reply to: Jim: "How to search files for text string most efficiently?"
- Next in thread: Herfried K. Wagner [MVP]: "Re: How to search files for text string most efficiently?"
- Reply: Herfried K. Wagner [MVP]: "Re: How to search files for text string most efficiently?"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|