V
vsk
Hai All,
How to read all files present in a directory in C ?.
Thanks,
How to read all files present in a directory in C ?.
Thanks,
vsk said:How to read all files present in a directory in C ?.
Ben said:This is in the FAQ.
19.20: How can I read a directory in a C program?
A: See if you can use the opendir() and readdir() functions, which
are part of the POSIX standard and are available on most Unix
variants. Implementations also exist for MS-DOS, VMS, and other
systems. (MS-DOS also has FINDFIRST and FINDNEXT routines which
do essentially the same thing.) readdir() only returns file
names; if you need more information about the file, try calling
stat(). To match filenames to some wildcard pattern, see
question 13.7.
References: K&R2 Sec. 8.6 pp. 179-184; PCS Sec. 13 pp. 230-1;
POSIX Sec. 5.1; Schumacher, ed., _Software Solutions in C_
Sec. 8.
Thomas Matthews said:Ben, a suggestion: also include the link to the
FAQ. Your reply doesn't inform the OP how to get
to the FAQ or where it came from. Hmmmm, kind of
like citing your references. ;-)
Mike said:I'm all for helping folks, but imo the 'hand holding'
can get out of hand, causing some to view the regulars
here as virtual servants. Anyone can type "C FAQ" into
google and find it.
Newcomer said:Such behaviour also helps keep the 'elect' and the mere rabble
separate. What's more important? To help those who need it, or to show
disdain for those who don't know what you happen to know?
FAQ's are very often concerned with netiquette and topical definitions;
and I for one had not assumed there was a collection of 'those' sort of
frequent questions about C.
However if this (suggested by Google)
http://www.eskimo.com/~scs/C-faq/faq.html
was what you were talking about, it wouldn't open.
Want to reply to this thread or ask your own question?
You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.