Difference between revisions of "Talk:Recursive filesearch"
(? Operator has a 1:1 replacement in Pascal) |
|||
(One intermediate revision by one other user not shown) | |||
Line 10: | Line 10: | ||
</source> | </source> | ||
− | one could write: | + | one could write: |
<source lang=pascal> | <source lang=pascal> | ||
s := IfThen(ap^.ap_Info.fib_DirEntryType < 0, '', 'Dir') | s := IfThen(ap^.ap_Info.fib_DirEntryType < 0, '', 'Dir') | ||
</source> | </source> | ||
− | [[User:Alb42| | + | (if for strings need Unit StrUtils, for number need unit Math) |
+ | |||
+ | Besides I'm a little bit worried, that a '''recursive''' Filesearch is not coded recursively :-) | ||
+ | --[[User:Alb42|ALB42]] ([[User talk:Alb42|talk]]) 11:11, 17 August 2014 (CEST) | ||
---- | ---- | ||
+ | |||
+ | Indeed, i 'missed' the ifthen solution. Something i came to learn about a little later on. fwiw: i initially used my own iif routines, but ripped them out for this routine to not confuse the reader (in original a-e post). | ||
+ | |||
+ | Sorry for the 'simple' copy-paste. I'll try adding explanations later on. Which btw will also handle the topic of why this recursive search does not call itself recursively (i can't help commodore invented 'dumbwitted' OS calls that does things automatically for us ;-p). | ||
+ | |||
+ | I'll add the Freepascal native counterpart alongside as well to compare/explain. |
Latest revision as of 11:06, 18 August 2014
Hint "?" Operator does not exist but there is a replacement:
if (ap^.ap_Info.fib_DirEntryType < 0) then
begin
s := '';
end else
s := 'Dir';
one could write:
s := IfThen(ap^.ap_Info.fib_DirEntryType < 0, '', 'Dir')
(if for strings need Unit StrUtils, for number need unit Math)
Besides I'm a little bit worried, that a recursive Filesearch is not coded recursively :-) --ALB42 (talk) 11:11, 17 August 2014 (CEST)
Indeed, i 'missed' the ifthen solution. Something i came to learn about a little later on. fwiw: i initially used my own iif routines, but ripped them out for this routine to not confuse the reader (in original a-e post).
Sorry for the 'simple' copy-paste. I'll try adding explanations later on. Which btw will also handle the topic of why this recursive search does not call itself recursively (i can't help commodore invented 'dumbwitted' OS calls that does things automatically for us ;-p).
I'll add the Freepascal native counterpart alongside as well to compare/explain.