1. re prompt_string To Chris Bensler..NO print output !
- Posted by Les Rogers <selgor1 at verizonmail.com> Feb 02, 2007
- 572 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.
2. Re: re prompt_string To Chris Bensler..NO print output !
- Posted by don cole <doncole at pacbell.net> Feb 02, 2007
- 556 views
Les Rogers wrote: > > > 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. Hello Les, I just ran your code and it seems to work splendidly to the screen. If you are talking about the printer then you should understand that in puts(1,"*") 1=the screen ;Printer=the printer. Don Cole
3. Re: re prompt_string To Chris Bensler..NO print output !
- Posted by Chris Bensler <bensler at nt.net> Feb 02, 2007
- 559 views
Les Rogers wrote: > > > 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 ? > <SNIP> > Try adding this: if atom( dir(name) ) then -- test if name exists puts(1,name&" is not a valid directory name or does not exist.\n") w = wait_key() abort(0) -- exit the program end if > exit_code = walk_dir(name,routine_id("look_at"),FALSE) > > w=wait_key() You will need to type a path name like c:\euphoria when the program asks you for the directory. Chris Bensler ~ The difference between ordinary and extraordinary is that little extra ~ http://empire.iwireweb.com - Empire for Euphoria