re prompt_string To Chris Bensler..NO print output !
- Posted by Les Rogers <selgor1 at verizonmail.com> Feb 02, 2007
- 570 views
Chris, Below is the revised programme . There is no directory output just asks for directory... prints the name ... then here it is etc BUT, nothing more What have I left out ? I put your code in ... but nothing out ? sorry to be a nuisance once more. include file.e include get.e constant FALSE = 1 object exit_code integer tabs tabs=0 atom k,w k=0 sequence name name={} --Here is the function ya need.. function look_at(sequence path_name,sequence entry) integer ret ret = 0 -- default exit code if k=0 then -- it's not a good idea to put multiple statements on one line -- the 2nd statement is easily missed printf(1,"%s \n\n",{path_name}) k=1 end if puts(1,"\t") if find('d',entry[D_ATTRIBUTES]) then puts(1,"\n\t\t<SUB DIR> ") end if printf(1,"%s%s\n",{repeat('\t',tabs),entry[D_NAME]}) if find('d',entry[D_ATTRIBUTES]) then puts(1," \n") tabs += 1 -- recurse into subdirectory -- we need to walk the subdirectories ourself so we know when they are finished ret = walk_dir(path_name&"\\"&entry[D_NAME],routine_id("look_at"),FALSE) tabs -= 1 -- unindent end if return ret end function -- Using FALSE instead of TRUE, walk_dir() will traverse only the top-level --in the specified directory. -- Subdirectories are traversed via the look_at() function. name = prompt_string("Directory ") printf(1,"%s\n\n\n" ,{name}) puts(1," You wanted " & name ) puts(1," Well here it is >>> \n\n") exit_code = walk_dir(name,routine_id("look_at"),FALSE) w=wait_key() Will you please still help ??? yours les.r.