Just curious: is it possible to recursively list all the
directorys/files inside a given directory using standard c i/o library
routines only, which can be re-compiled and run on any os supportes c
compiler? Or this is too os dependent, system-specific functions must
be called?
I think about this when i tried to do this under windows, i found in
order to achieve this, some windows-specific api such as
FindFirstFile, FindNextFile must be used, so anyway not using them?
Forgive my poor English, Thanks in advance. 10 3627
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
ibic wrote: Just curious: is it possible to recursively list all the directorys/files inside a given directory using standard c i/o library routines only,
Sorry, but standard C does not recognize the concept of a directory, and there
are no functions in the standard C library to list (recursively or otherwise)
the contents of directories.
You are going to have to look to an extension that supports such things. FWIW,
the POSIX extensions to C are useable under a large number of operating systems,
including all Unix-ish systems, and (so I am told) Microsoft Windows.
- --
Lew Pitcher
IT Consultant, Enterprise Data Systems,
Enterprise Technology Solutions, TD Bank Financial Group
(Opinions expressed are my own, not my employers')
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (MingW32)
iD8DBQFBmRJeagVFX4UWr64RApeWAKClqSiabUpuryinHORf3L rz7DpUFQCdEPGd
E4jOFEQUvljD0ASNp5sndG8=
=MPTi
-----END PGP SIGNATURE-----
On 15 Nov 2004 12:19:52 -0800, ib****@gmail.com (ibic) wrote: Just curious: is it possible to recursively list all the directorys/files inside a given directory using standard c i/o library routines only, which can be re-compiled and run on any os supportes c compiler? Or this is too os dependent, system-specific functions must be called? I think about this when i tried to do this under windows, i found in order to achieve this, some windows-specific api such as FindFirstFile, FindNextFile must be used, so anyway not using them?
And you should be aware that there are major operating systems which
don't use directories at all.
<<Remove the del for email>>
In <fn********************************@4ax.com> Barry Schwarz <sc******@deloz.net> writes: And you should be aware that there are major operating systems which don't use directories at all.
Calling them "major" is a bit of an exaggeration, these days. "Legacy"
is a more appropriate term.
Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Currently looking for a job in the European Union
rOn 16 Nov 2004 14:29:32 GMT, Da*****@cern.ch (Dan Pop) wrote: In <fn********************************@4ax.com> Barry Schwarz <sc******@deloz.net> writes:
And you should be aware that there are major operating systems which don't use directories at all.
Calling them "major" is a bit of an exaggeration, these days. "Legacy" is a more appropriate term.
*I* have a hard time calling something whose newest release is less
than a year old "legacy". *B*ut I don't have a hard time calling
something that generates hundreds of millions of dollars of revenue
for its vendor "major". *M*aybe we just look at things differently.
<<Remove the del for email>>
"Barry Schwarz" <sc******@deloz.net> wrote in message
news:pl********************************@4ax.com... rOn 16 Nov 2004 14:29:32 GMT, Da*****@cern.ch (Dan Pop) wrote:
In <fn********************************@4ax.com> Barry Schwarz
<sc******@deloz.net> writes:And you should be aware that there are major operating systems which don't use directories at all.
Calling them "major" is a bit of an exaggeration, these days. "Legacy" is a more appropriate term.
*I* have a hard time calling something whose newest release is less than a year old "legacy". *B*ut I don't have a hard time calling something that generates hundreds of millions of dollars of revenue for its vendor "major". *M*aybe we just look at things differently.
Please Master, break the news upon us...
Let us in on this major secret...
Deliver us from evil directory trees !
Let the world be flat again !
Chqrlie
In <pl********************************@4ax.com> Barry Schwarz <sc******@deloz.net> writes: rOn 16 Nov 2004 14:29:32 GMT, Da*****@cern.ch (Dan Pop) wrote:
In <fn********************************@4ax.com> Barry Schwarz <sc******@deloz.net> writes:
And you should be aware that there are major operating systems which don't use directories at all.
Calling them "major" is a bit of an exaggeration, these days. "Legacy" is a more appropriate term.
*I* have a hard time calling something whose newest release is less than a year old "legacy". *B*ut I don't have a hard time calling something that generates hundreds of millions of dollars of revenue for its vendor "major". *M*aybe we just look at things differently.
It might be a major product for its vendor, it's still a legacy OS for
those stuck with it. At a previous job, one of the main reasons they
decided to get rid of their large mainframe configuration was precisely
the lack of directory support.
Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Currently looking for a job in the European Union
In article <cn**********@sunnews.cern.ch>, Da*****@cern.ch (Dan Pop) writes: It might be a major product for its vendor, it's still a legacy OS for those stuck with it.
Mainframes are selling like (expensive) hotcakes, and plenty of their
users are still very happy with them. As a definition of "legacy",
this is pretty useless.
At a previous job, one of the main reasons they decided to get rid of their large mainframe configuration was precisely the lack of directory support.
We can play dueling anecdotes all day.
Call them "legacy" if you like, but I'm with Barry on this one. In
any event, there are people writing C programs that have to run on
platforms where there is no hierarchical directory structure such as
the OP's project assumed. Obviously, there are also many C programs
being written that make that assumption and get along fine, since
they never need to run on such a platform.
--
Michael Wojcik mi************@microfocus.com
I said, 'I need to put my soul into my work and it is well known that
computers haven't got a soul.' My father said, 'The Americans are working
on it.' -- Sue Townsend, _The Secret Diary of Adrian Mole, Aged 13 3/4_
In article <cn**********@reader1.imaginet.fr>, "Charlie Gordon" <ne**@chqrlie.org> writes: "Barry Schwarz" <sc******@deloz.net> wrote in message news:pl********************************@4ax.com... rOn 16 Nov 2004 14:29:32 GMT, Da*****@cern.ch (Dan Pop) wrote:In <fn********************************@4ax.com> Barry Schwarz <sc******@deloz.net> writes: >And you should be aware that there are major operating systems which >don't use directories at all.
Calling them "major" is a bit of an exaggeration, these days. "Legacy" is a more appropriate term. *I* have a hard time calling something whose newest release is less than a year old "legacy". *B*ut I don't have a hard time calling something that generates hundreds of millions of dollars of revenue for its vendor "major". *M*aybe we just look at things differently.
Please Master, break the news upon us... Let us in on this major secret...
It's hardly a secret. A little research would suffice to identify
operating systems that do not use hierarchical-directory filesystems
(at least for their dominant filesystem), or use something which may
resemble a hierarchical-directory filesystem in some respects but not
in others (so that the OP's project would not be applicable). OS/400
is one; zOS is another.
Let the world be flat again !
Such research would also demonstrate that filesystems without
hierarchical directories (in the Unix model) need not be flat.
--
Michael Wojcik mi************@microfocus.com
Most people believe that anything that is true is true for a reason.
These theorems show that some things are true for no reason at all,
i.e., accidentally, or at random. -- G J Chaitin
In <cn********@news3.newsguy.com> mw*****@newsguy.com (Michael Wojcik) writes: In article <cn**********@sunnews.cern.ch>, Da*****@cern.ch (Dan Pop) writes: It might be a major product for its vendor, it's still a legacy OS for those stuck with it. Mainframes are selling like (expensive) hotcakes, and plenty of their
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Any factual evidence for that? From my own experience, their market is
getting narrower and narrower. I've witnessed the phasing out of
mainframes at two sites, but I've never seen a site adopting them as the
right solution for its problems. I've a strong feeling that the new
mainframes sold replace old mainframes rather than increasing the number
of mainframes in current use. Hence the "legacy" thing.
users are still very happy with them.
The users are happy that their legacy applications continue to work.
Few people develop *new* applications for that platform.
As a definition of "legacy", this is pretty useless.
I don't think so. Compare the number of mainframe installations today
with that of 20 - 25 years ago. Ditto about the amount of new software
developed for mainframes. And, finally, try to figure out the health
state of BITNET/EARN today.
Dan
--
Dan Pop
DESY Zeuthen, RZ group
Email: Da*****@ifh.de
Currently looking for a job in the European Union
On 17 Nov 2004 19:43:04 GMT, mw*****@newsguy.com (Michael Wojcik)
wrote: >>And you should be aware that there are major operating systems which >>don't use directories at all.
<snip> It's hardly a secret. A little research would suffice to identify operating systems that do not use hierarchical-directory filesystems (at least for their dominant filesystem), or use something which may resemble a hierarchical-directory filesystem in some respects but not in others (so that the OP's project would not be applicable). OS/400 is one; zOS is another.
Let the world be flat again !
Such research would also demonstrate that filesystems without hierarchical directories (in the Unix model) need not be flat.
And to avoid being forgotten, the Guardian personality/mode of
Tandem^WCompaq^WHP NonStop, which is still used and needed for some
new applications because it provides features the POSIX personality
cannot although the overwhelming majority of applications are legacy,
has exactly two levels of directory per disk (or pseudodisk) -- or
actually, two levels of naming in a global directory rather like the
OS/360-et-seq system catalog. Thus you can enumerate files in a
directory -- with a native API, actually two(!) of them, different
from either the Windows or POSIX ones -- and disks (and other devices)
and systems with (sometimes) different API(s) -- but you can never
find or enumerate a (sub)directory in a directory. Of course, if your
code just goes by what you get from the enumeration it is only a waste
of effort but no real harm to handle an impossible case.
- David.Thompson1 at worldnet.att.net This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: David Jacques |
last post by:
I am trying to get a list of all files of a certain extension type on disk
to
do some processing in a loop. The code needs to be portable to UNIX, so
I need to use plain c functionality. Does...
|
by: minil |
last post by:
Hi
any c function in linux to return size of directory (Including its
files & subdirectories & its files)..
I can stat() only files . not for directories.
please reply me soon
Thanks in...
|
by: Martin |
last post by:
Hi,
I have implemeted a recursive function that basically iterate throught the
entire file system and prints out the entire path of each directory that it
come across.
The only problem is the...
|
by: F. Michael Miller |
last post by:
I'd like to copy the listing of a directory (& sub directories) to a text
file in vb.net.
I'm looking for teh equivilant of the DOS command dir /s >
TargetFile.txt.
Thanks!
|
by: rtilley |
last post by:
# Spaces are present before and after the XXX
filename = ' XXX '
new_filename = filename.strip()
if new_filename != filename:
print filename
Macs allow these spaces in file and folder...
|
by: Daniel C. Di Vita |
last post by:
I am stating to write a small app that allows a user to catalog their
CD/dvd collection. I need some help, however. Here is some test code I
wrote for the recursive listing:
Imports System...
|
by: Kristan |
last post by:
Hi there, quick question, how would I retrieve a list of files in ANSI C in
a purely platform independent way?
Any pointers would be great!
thanks
Kristan
|
by: johnwayne83 |
last post by:
This is my first semester in c++ and i took java last semester. I need
some help and i really cant find any information that has helped me or
to point me in the right direction.
I am using...
|
by: aki |
last post by:
Hi All,
I describe the problem as below.
A directory( path known) , contains 0 to any number of files .
The file names are with following structure :
...
|
by: DJRhino |
last post by:
Was curious if anyone else was having this same issue or not....
I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
|
by: Aliciasmith |
last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
|
by: tracyyun |
last post by:
Hello everyone,
I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
|
by: giovanniandrean |
last post by:
The energy model is structured as follows and uses excel sheets to give input data:
1-Utility.py contains all the functions needed to calculate the variables and other minor things (mentions...
|
by: NeoPa |
last post by:
Hello everyone.
I find myself stuck trying to find the VBA way to get Access to create a PDF of the currently-selected (and open) object (Form or Report).
I know it can be done by selecting :...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
|
by: nia12 |
last post by:
Hi there,
I am very new to Access so apologies if any of this is obvious/not clear.
I am creating a data collection tool for health care employees to complete. It consists of a number of...
|
by: NeoPa |
last post by:
Introduction
For this article I'll be focusing on the Report (clsReport) class. This simply handles making the calling Form invisible until all of the Reports opened by it have been closed, when it...
|
by: isladogs |
last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, Mike...
| |