* Directory contents
@ 2004-11-27 18:00 HIToC
2004-11-27 18:26 ` SVisor
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: HIToC @ 2004-11-27 18:00 UTC (permalink / raw)
To: Linux C programming; +Cc: Linux Assembly
Hi all!
I want to write a function that can read the contents of a specified directory
in order to find a certain type of file or to copy a directory-tree or
something else.
Neverthless I need of some system functions that find the files that are
contained in that directory (like FINDFIRST and FINDNEXT under ms-dos).
Who can help me?
--
With regards,
HIToC
hitoc_mail@yahoo.it
^ permalink raw reply [flat|nested] 6+ messages in thread* Re: Directory contents
2004-11-27 18:00 Directory contents HIToC
@ 2004-11-27 18:26 ` SVisor
2004-11-27 22:38 ` Emmet Ford
2004-11-29 7:25 ` sandeep
2 siblings, 0 replies; 6+ messages in thread
From: SVisor @ 2004-11-27 18:26 UTC (permalink / raw)
To: linux-c-programming
HIToC wrote:
...
> I want to write a function that can read the contents of a specified directory
> in order to find a certain type of file or to copy a directory-tree or
> something else.
> Neverthless I need of some system functions that find the files that are
> contained in that directory (like FINDFIRST and FINDNEXT under ms-dos).
opendir( ) and readdir( ) might be what you are looking for?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Directory contents
2004-11-27 18:00 Directory contents HIToC
2004-11-27 18:26 ` SVisor
@ 2004-11-27 22:38 ` Emmet Ford
2004-11-29 4:13 ` Brian Raiter
2004-11-29 7:25 ` sandeep
2 siblings, 1 reply; 6+ messages in thread
From: Emmet Ford @ 2004-11-27 22:38 UTC (permalink / raw)
To: HIToC; +Cc: Linux C programming, Linux Assembly
opendir, readdir, closedir are C standard library calls.
HIToC wrote:
>Hi all!
>
>I want to write a function that can read the contents of a specified directory
>in order to find a certain type of file or to copy a directory-tree or
>something else.
>Neverthless I need of some system functions that find the files that are
>contained in that directory (like FINDFIRST and FINDNEXT under ms-dos).
>
>Who can help me?
>
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Directory contents
2004-11-27 18:00 Directory contents HIToC
2004-11-27 18:26 ` SVisor
2004-11-27 22:38 ` Emmet Ford
@ 2004-11-29 7:25 ` sandeep
2004-11-29 7:57 ` Jan-Benedict Glaw
2 siblings, 1 reply; 6+ messages in thread
From: sandeep @ 2004-11-29 7:25 UTC (permalink / raw)
To: HIToC; +Cc: Linux C programming, Linux Assembly
> I want to write a function that can read the contents of a specified directory
> in order to find a certain type of file or to copy a directory-tree or
> something else.
> Neverthless I need of some system functions that find the files that are
> contained in that directory (like FINDFIRST and FINDNEXT under ms-dos).
>
> Who can help me?
"man scandir" and man on functions mentioned at the end of that manpage.
--
regards
sandeep
--------------------------------------------------------------------------
You probably wouldn't worry about what people think of you if you could
know how seldom they do.
-- Olin Miller.
--------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Directory contents
2004-11-29 7:25 ` sandeep
@ 2004-11-29 7:57 ` Jan-Benedict Glaw
0 siblings, 0 replies; 6+ messages in thread
From: Jan-Benedict Glaw @ 2004-11-29 7:57 UTC (permalink / raw)
To: linux-c-programming, linux-assembly
[-- Attachment #1: Type: text/plain, Size: 2040 bytes --]
On Mon, 2004-11-29 12:55:17 +0530, sandeep <sandeep@codito.com>
wrote in message <41AACEDD.4080509@codito.com>:
> >I want to write a function that can read the contents of a specified
> >directory
> >in order to find a certain type of file or to copy a directory-tree or
> >something else.
> >Neverthless I need of some system functions that find the files that are
> >contained in that directory (like FINDFIRST and FINDNEXT under ms-dos).
> >
> >Who can help me?
> "man scandir" and man on functions mentioned at the end of that manpage.
From the man page:
----------------------------- >8 ======================================
CONFORMING TO
None of these functions is in POSIX. LSB has deprecated the library
call alphasort() and never contained scandir().
The functions scandir() and alphasort() are from BSD 4.3, and have been
available under Linux since libc4. Libc4 and libc5 use the more pre-
cise prototype
int alphasort(const struct dirent **a, const struct dirent **b);
but glibc 2.0 returns to the imprecise BSD prototype.
The function versionsort() is a GNU extension, available since glibc
2.1. Since glibc 2.1, alphasort() calls strcoll(3); earlier it used
strcmp(3).
============================================ 8< -----------------------
So I guess you don't really want to use these functions. opendir(),
readdir() and closedir() are what's ment for that. If you're actually
writing an libc replacement (and thus need to use the syscall interface
instead of the libc interface), you can use open(..., ... | O_DIRECTORY)
in conjunction with getdents().
MfG, JBG
--
Jan-Benedict Glaw jbglaw@lug-owl.de . +49-172-7608481 _ O _
"Eine Freie Meinung in einem Freien Kopf | Gegen Zensur | Gegen Krieg _ _ O
fuer einen Freien Staat voll Freier Bürger" | im Internet! | im Irak! O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2004-11-29 7:57 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-27 18:00 Directory contents HIToC
2004-11-27 18:26 ` SVisor
2004-11-27 22:38 ` Emmet Ford
2004-11-29 4:13 ` Brian Raiter
2004-11-29 7:25 ` sandeep
2004-11-29 7:57 ` Jan-Benedict Glaw
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).