本文介绍了用于检索驱动器中所有文件名的程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


我需要一个简短的程序:


给定一个驱动器号,它将递归搜索所有目录,

生成它遇到的每个文件名(需要将每个文件名传递给

一个函数)。


不能不这么认为这个实用程序已经存在,但如果我能找到

就可以了。


任何帮助都将不胜感激。提前致谢

Hi all,

I have a need for a short program:

Given a drive letter, it would recursively search through all directories,
"generating" each filename that it encounters (need to pass each filename to
a function).

Can''t help but think this "utility" already exists but f**ked if I can find
it.

Any help would be greatly appreciated. Thanks in advance

推荐答案




这与C语言凯文没有任何关系。你不在话题。

但无论如何它是:


DIR C:\ / B / S / AA> tmpfile


tmpfile将包含驱动器中的所有文件。



This has nothing to do with the C language kevin. You are off topic.
But anyway here it is:

DIR C:\ /B /S /AA >tmpfile

tmpfile will contain all files in the drive.



文件名传递给

filename to


找到



这与C语言凯文没有任何关系。你不在话题。
但无论如何它是:

DIR C:\ / B / S / AA> tmpfile

tmpfile将包含所有文件在驱动器中。



This has nothing to do with the C language kevin. You are off topic.
But anyway here it is:

DIR C:\ /B /S /AA >tmpfile

tmpfile will contain all files in the drive.





不幸的是你不能在ANSI C中这样做。没有目录 ;

功能。这很糟糕,我不知道理由是什么。


然而肯定会有一个readdir。或类似的功能

您使用的平台可以实现您想要实现的目标。


Unfortunately you can''t do this in ANSI C. There are no "directory"
functions. This is pretty bad and I don''t know what the justification is.

However there will certainly be a "readdir" or similar function specific to
the platform you use which accomplishes what you are trying to achieve.


这篇关于用于检索驱动器中所有文件名的程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-03 01:11