Re: searching...
- Posted by Jacques Deschenes <desja at QUEBECTEL.COM> May 11, 1997
- 969 views
At 08:17 97-05-09 -0400, you wrote: >O.K., I am in the process of making an update to my ZipMaster program. > >The thing that bugs me most about it is that it is so darn slow! I search >the file string by string comparing every word to each other. Does anyone >else know a faster way to look for certain words withen text files? Instead of checking each line character by character your program could eliminate most of them with a simple test like: sequence line -- contain line read from file if not match("include",line) and not find('"',line) then return -- skip this line end if Your zip master is only concern by lines that begin with the word "include" and others that have double quotes. Resources files names have to be between double quotes. And zip master doesn't need to know wich procedure or function load the requested resource. Zip master only have to check if the double quotes enclose a valid file name. Your program could have a function that check the contain of any double quotes found in the file to see if it is a file name, a directory name or else. Directories names are added to a sequence containing path_list for future search of files. File names are searched on hard disk in any directory member of path_list and current directory. the preceding method is based on the following assumptions: 1) any line beginning with the word "include" is followed by file name and nothing else. 2) Any double quote containing a path name is certainly assigned to a constant or variable that point to directory where the program search files. 3) Any double quote containing a string that is a valid dos file name is possibly a resource name. It can be confirmed by searching on disk for such a file. I have tested this method with success. Jacques Deschenes Baie-Comeau, Quebec Canada desja at quebectel.com