Re: Problem using walk_dir
- Posted by Matt Lewis <matthewwalkerlewis at gmail.com> Nov 09, 2005
- 421 views
Joel Garcia wrote: > > I have created a small program to strip content from a series of HTML files > and store this new data in a CSV formatted text file. The problem I am > experiencing > is in regard to the walk_dir command for parsing each HTML file. The files > have all been examined and tested individually to be sure they can be stripped > by my routine. But what is happening is that after the first 18 files are > read, > the program ends without processsing file 19 and never continues beyond that. > <snip>
function look_at(sequence path_name, sequence entry) sequence input_file input_file = path_name & "\\" & entry[1] printf(fn_out, "%s", {input_file}) printf(fn_out, "%s", {"\n"}) fn = open(input_file, "r") if fn = -1 then puts(1, "Couldn't open file\n") abort(1) end if return 0 -- 0 to keep going end function
You never close the files, so eventually, you run into the open file limit. Add a "close(fn)" before the "return 0" and it should work correctly. Matt Lewis