Re: Problem using walk_dir

new topic     » goto parent     » topic index » view thread      » older message » newer message

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

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu