Lazarus
Free Pascal => General => Topic started by: sigipa on March 29, 2017, 08:18:38 am
-
Hello All,
I'm new to pascal, so please forgive my ignorance. I've been searching for a function to read a directory. I'm aware of FindFirst, but I don't need any kind of search testing or the overhead of that. Is there a function that will just read a directory ala libc opendir/readdir?
Thanks,
-S
-
Hello All,
I'm new to pascal, so please forgive my ignorance. I've been searching for a function to read a directory. I'm aware of FindFirst, but I don't need any kind of search testing or the overhead of that. Is there a function that will just read a directory ala libc opendir/readdir?
Hi sigipa,
FindAllFiles from fileutil perhaps?
http://wiki.freepascal.org/FindAllFiles
-
Hi,
I saw that, but I fear that it will be doing some unnecessary testing on the filter (or lack thereof). I'll take a look at the source to see if that is an issue. I appreciate the pointer.
Thanks,
-S
-
findfirst/next on unix is roughly opendir/readdir + stat per file.
readdir is pages of code so a simple test on an integer value to check if it is a dir is not measurable. The stat thing might be measurable though, but that is the price of portability.