由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Programming版 - Listing files under a directory in C++
相关主题
should the .dll and .lib have the same name?Qt Creator
请教一个弱弱问题,关于#include的pathnamea PERL opendir/readdir question
How to fix this? /bin/ls: Argument list too long*** help needed! on MATLAB GUI ***
how to include header file in other directory?what's wrong with this scripts?variable passing?
How to link math library in VC2005?cgi测试newbee问题
请教,关于g++ -l的问题remove a module from cvs
windows 7 file chooser 的问题sdk那个register directories with vs有什么用?
linux, find command question新手弱问:怎么让VC记住新添加的库文件?
相关话题的讨论汇总
话题: under话题: c++话题: directory话题: listing话题: files
进入Programming版参与讨论
1 (共1页)
s*****c
发帖数: 753
1
Hi, I need to list all files under a directory in C++. How do I achieve
this. I checked and there seems to be direct.h under windows and unistd.h
under linux that provide some operation on the file system. But I fail to
see any function that provide this capability. Anything that I missed? Or
should I have to perform a system call to invoke "dir abc*" or "ls abc*"?
t****t
发帖数: 6806
2
you may use opendir() family function, which is specified in POSIX.1-2001.

【在 s*****c 的大作中提到】
: Hi, I need to list all files under a directory in C++. How do I achieve
: this. I checked and there seems to be direct.h under windows and unistd.h
: under linux that provide some operation on the file system. But I fail to
: see any function that provide this capability. Anything that I missed? Or
: should I have to perform a system call to invoke "dir abc*" or "ls abc*"?

s*****c
发帖数: 753
3
Thanks alot, this is helpful. So I can use this under linux.
Is there solutions under windows? I don't want to use boost library since
what I am trying to implement is some extra feature. I don't want to drag
in a third party library for this. Also I don't want to use MSDN's
FindNextFile() since it will use windows.h, and will add dependencies.
If there are no better solutions, I think I would rather do a system("dir
abc* >output.txt") and then check the content of the output.txt.

【在 t****t 的大作中提到】
: you may use opendir() family function, which is specified in POSIX.1-2001.
r*********r
发帖数: 3195
4
use filesystem library in boost.
1 (共1页)
进入Programming版参与讨论
相关主题
新手弱问:怎么让VC记住新添加的库文件?How to link math library in VC2005?
请教如何在VC6下面安装gsl?请教,关于g++ -l的问题
面试题, 一个目录(directory)下一般最多放多少文件 ?windows 7 file chooser 的问题
gdb debugging issue求助linux, find command question
should the .dll and .lib have the same name?Qt Creator
请教一个弱弱问题,关于#include的pathnamea PERL opendir/readdir question
How to fix this? /bin/ls: Argument list too long*** help needed! on MATLAB GUI ***
how to include header file in other directory?what's wrong with this scripts?variable passing?
相关话题的讨论汇总
话题: under话题: c++话题: directory话题: listing话题: files