Re: Problem using walk_dir
- Posted by "Juergen Luethje" <j.lue at gmx.de> Nov 09, 2005
- 415 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. > > Below is a shortened version of my code showing how I have used > walk_dir. > If someone knows what it is I have omitted or done incorrectly, I would > appreciate the help and advice. It's just a quick and dirty program at > the moment, but I need to get this functioning properly before moving > on to refine the rest of it. Thank you in advance. > > Joel > > ===Sample code=== > > include get.e > include keys.e > include fileio.e > > constant output_file = "output.txt" > > object exit_code > integer fn, fn_out > > fn_out = open(output_file, "w") > > 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 -- process file contents, and then ... close(fn) > return 0 -- 0 to keep going > end function > > exit_code = walk_dir("C:\\EUPHORIA\\My Programs\\My Files", > routine_id("look_at"), 0) You should close the files anyway. Maybe this already solves the problem. Regards, Juergen -- Have you read a good program lately?