C ++搜索目录和文件 [英] C++ search directories and files
问题描述
有人可以告诉我是否有一个内置的C ++库,我可以用来获取文件和目录的列表?我看过周围,我看到人们使用dirent.h,但我需要下载它(我想)。
感谢
PS我已经看过fstream,但这只是为了读取和输出文件,就我所知。
FORGOT TO MENTION。我不想下载任何,我想要看看是否是一个内置的C ++,我可以使用直接BAT。这是为WINDOWS ASWELL
您可以使用 Boost Filesystem
http://www.boost.org/doc/libs/1_31_0/libs/filesystem/doc/index.htm
一些不错的样本
没有下载第三方库,没有可移植的方式去做吧。对于Windows,您可以使用 CFileFind 类从MFC。
Can someone tell me if there is a library built in C++ that I can use to get a list of files and directories? I've looked around and I see people using dirent.h but I need to download it(i think).
Thanks
P.S. I've looked at the fstream, but thats only for reading and outputting files as far as i know.
FORGOT TO MENTION. I DO NOT WANT TO DOWNLOAD ANYTHING, I JUST WANT TO SEE IF THERE IS A LIBRARY THAT IS BUILT WITHIN C++ THAT I CAN USE STRAIGHT OFF THE BAT. THIS IS FOR WINDOWS ASWELL
You can use Boost Filesystem
library.
http://www.boost.org/doc/libs/1_31_0/libs/filesystem/doc/index.htm
Some nice samples are also provided at the link.
EDIT:
Without downloading a 3rd party library, there is no portable way to do it. For windows you can use CFileFind class from MFC.
这篇关于C ++搜索目录和文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!