[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Scanning directories
- From: Gavin Wraith <gavin@...>
- Date: Wed, 29 Oct 2003 12:02:24 +0000 (GMT)
Is it possible to extend the os library with
a directory-scanning function, like Perl's
'readdir', and still keep within ANSI C?
Of course we can each implement something
for our own platform but it would be nice
to be able to do this in a more portable way.
I have a function 'dirlist' that takes
a string as an argument. It returns nil
followed by an error message if the argument
is not the pathname of a directory for some
filing system (that supports directories) or if the
directory is not readable. Otherwise it returns
a table whose indices are the leafnames of
the files within and whose values are
tables of attributes (filetype, size, permissions,
date, etc). I find I use it quite a lot, and it
is something I would like to see standardized.
--
Gavin Wraith (gavin@wraith.u-net.com)
Home page: http://www.wraith.u-net.com/