Re: A function for ls?
- From: Dave Neary <dneary eircom net>
- To: Germano Rizzo <manomano ciaoweb it>
- Cc: gtk-list gnome org
- Subject: Re: A function for ls?
- Date: Fri, 23 Feb 2001 20:25:56 +0000
On Fri, Feb 23, 2001 at 04:24:04PM +0100, Germano Rizzo wrote:
> Hi!
> is there a library function that gives the contents of a directory?
> Something like 'ls'... or a way to do it using other functions? At least,
> may you address me to a program that uses such a function, to learn on it? I
> browsed the source of ls, but it's... too much! ;)
Yes there is, but (obviously, being a system call) it's not
portable.
The POSIX way to do it is to use operdir(), dirent(), rewinddir()
and closedir(). These should all be in section 2 of your man
pages... chdir() and fchdir() can be used to change directories,
and then normal file i/o operations can be used once you have the
file(s) you want.
> Mano :)
Cheers,
Dave.
--
.------------------------------.
/ David Neary, \
| E-Mail dneary eircom net |
\ Phone +353-1-872-0654 /
`------------------------------'
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]