Re: Please help with Formatting Programme Output
Les Rogers wrote:
>
>
> This programme prints all directories and all files
> in directory and all sub-directories and files :-
>
> include file.e
> include get.e
> constant TRUE=1
> object exit_code
> atom k,w
> k=0
>
> function look_at(sequence path_name,sequence entry)
> if k=0 then printf(1,"%s\n\n",{path_name}) k=1 end if
> puts(1,"\t")
> printf(1,"%s",{entry[D_NAME]})
> puts(1,"\n")
> return 0
> end function
>
> exit_code=walk_dir("c:\\", routine_id("look_at"),TRUE)
> k=0
> w=wait_key()
>
> Format I would like is :-
>
> Directory name
> files ........... indented as shown
>
> Sub-Directory ........ indented as shown
> files ........... indented as shown
>
> Next Directory Name
> files
>
> Sub-Directory
> files
>
> etc.
>
> I don't know how to tell the computer when a new directory is there
> and how to distinguish a file from a directory ??????
>
> if it is too difficult then O.K.
>
> Thank you for taking time to read my message .
>
> les.r.
integer tabs
tabs = 0
function look_at(sequence path_name,sequence entry)
if k=0 then printf(1,"%s\n\n",{path_name}) k=1 end if
printf(1,"%s%s\n",{repeat('\t',tabs),entry[D_NAME]})
if find('d',entry[D_ATTRIBUTES]) then
tabs += 1
end if
return 0
end function
hope that helps
Chris Bensler
~ The difference between ordinary and extraordinary is that little extra ~
http://empire.iwireweb.com - Empire for Euphoria
|
Not Categorized, Please Help
|
|