Re: Directory reading
- From: Keith Thompson <kst-u@xxxxxxx>
- Date: Thu, 04 Dec 2008 14:51:27 -0800
mattia <gervaz@xxxxxxxxx> writes:
On Thu, 04 Dec 2008 21:38:11 +0000, Antoninus Twink wrote:
On 4 Dec 2008 at 20:24, vippstar@xxxxxxxxx wrote:
On Dec 4, 10:19 pm, mattia <ger...@xxxxxxxxx> wrote:
Hi everyone, can you suggest me an efficient way to list all the files
in a directory (under linux)?
Off-topic here. Try asking in <comp.unix.programmer>.
"VIP Star" is a troll who seeks to disrupt the newsgroup, best ignored.
Check out readdir(3), and post again if you have any problems.
Ok, done, found what I was looking for at advancedlinuxprogramming.com,
I'll not consider vipstar sugestions again ;-)
That's a bad idea. "Antoninus Twink" is very likelyi correct that
readdir() is the solution to your problem, but he's quite simply lying
about vippstar. "Antoninus Twink" is a troll who deliberately tries
to disrupt this newsgroup, mostly by encouraging off-topic discussions
that should take place in other newsgroups.
Here are the facts. The readdir function is not defined, or even
mentioned, by the standard that defines the C programming language.
In fact, there's no mention of directories at all. (It's been argued
that there should be, and there have been proposals to add directory
support in future revisions of the standard, but that hasn't happened
yet -- and defining directory support in a way that's compatible with
all the current and potential hosted systems on which C is supported
is decidedly non-trivial.)
The readdir function is defined by the POSIX standard, which means
(approximately) that it's specific to Unix and Unix-like systems. On
MS Windows, for example, you'd probably want to use some different
function to read a directory.
Here in comp.lang.c, we generally try to discuss the C programming
langauge as defined by the C language standard (past and current
versions). Questions about Unix-specific programming, such as how to
use readdir(), are better asked in comp.unix.programmer, which is full
of experts on the topic. Many of us here know about Unix programming
as well, but everyone makes mistakes, and any Unix-specific
information posted here will receive much less checking by experts
than similar information posted in comp.unix.programmer.
Similarly, questions about Windows programming should be asked in
comp.os.ms-windows.programmer.win32 or a similar group.
There was nothing seriously wrong with your original question; not
everyone can be expected to know that the C language doesn't actually
support directory operations. But vippstar's response was entirely
appropriate; since you're using Linux, comp.unix.programmer is the
right place to ask.
--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
Nokia
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
.
- Follow-Ups:
- Re: Directory reading
- From: viza
- Re: Directory reading
- From: CBFalconer
- Re: Directory reading
- From: Kenny McCormack
- Re: Directory reading
- References:
- Directory reading
- From: mattia
- Re: Directory reading
- From: vippstar
- Re: Directory reading
- From: Antoninus Twink
- Re: Directory reading
- From: mattia
- Directory reading
- Prev by Date: Re: Directory reading
- Next by Date: Re: Directory reading
- Previous by thread: Re: Directory reading
- Next by thread: Re: Directory reading
- Index(es):
Relevant Pages
|