Re: A function for ls?



On Fri, Feb 23, 2001 at 08:25:56PM +0000, Dave Neary wrote:
> 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.

section 2 is system calls, those are like you said library calls (section 3) :)
ok no more traffic for the non gtk question now

> 
> >     Mano :)
> 
> Cheers,
> Dave.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]