使用标准/便携式C的目录/文件递归列表? [英] Directory/File recursive listing using standard/portable C?
问题描述
好奇:是否可以使用标准ci / o库递归列出给定目录中的所有
directorys /文件
例程,可以重新编写编译并在任何操作系统支持上运行c
编译器?或者这太依赖于OS,系统特定的功能必须被调用吗?
我想到这个当我试图在windows下执行此操作时,我发现在
为了达到这个目的,一些特定于Windows的api如
必须使用FindFirstFile,FindNextFile,所以不管怎么说都不使用它们?
请原谅我可怜的英语,提前致谢。
-----开始PGP签名的消息-----
Hash:SHA1
ibic写道:好奇:是否可以递归列出给定目录中的所有
directorys /文件只使用标准的ci / o库
例程,
抱歉,标准C不识别目录的概念,并且有
不是标准C库中的函数列表(递归或其他)
目录的内容。
你将不得不看一个扩展支持这种事情的sion。 FWIW,
对于C的POSIX扩展可以在大量操作系统下使用,包括所有Unix-ish系统的
,以及(所以我被告知)Microsoft Windows。
- -
Lew Pitcher
IT顾问,企业数据系统,
企业技术解决方案,道明银行金融集团
(表达的意见是我自己的,而非我的雇主')
----- BEGIN PGP SIGNATURE --- -
版本:GnuPG v1.2.4(MingW32)
iD8DBQFBmRJeagVFX4UWr64RApeWAKClqSiabUpuryinHORf3L rz7DpUFQCdEPGd
E4jOFEQUvljD0ASNp5sndG8 =
= MPTi
-----结束PGP签名-----
2004年11月15日12:19:52 -0800 , ib****@gmail.com (ibic)写道:
Just好奇:是否可以使用标准的ci / o库
例程递归列出给定目录中的所有
directorys /文件o是的,哪些可以重新编译并运行在任何支持者编译器上?或者这太依赖于os,系统特定的功能必须被调用?
我想到这个当我试图在windows下做这个时,我发现为了实现这个目的,一些windows特定的api,比如
FindFirstFile,必须使用FindNextFile,所以不管怎样都不使用它们?
你应该知道有一些主要的操作系统
根本不使用目录。
<<删除电子邮件的del>>
< blockquote>在< fn ******************************** @ 4ax.com> Barry Schwarz< sc ****** @ deloz.net>写道:
你应该知道有一些主要的操作系统根本不使用目录。
>
将它们称为主要这些日子有点夸张。 Legacy
是一个更合适的术语。
Dan
-
Dan流行
DESY Zeuthen,RZ集团
电子邮件: Da ***** @ ifh.de
目前在欧盟寻找工作
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.
-----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
这篇关于使用标准/便携式C的目录/文件递归列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!