C++ 文件夹中的文件数
是否有一种特定的方法可以直接获取给定文件夹中的文件数? 比如: 还是我必须打开文件夹并遍历所有文件 我正在从Blender读取obj文件,并尝试加载动画。(大量顶点,每帧1个文件) 还有,为了表现。。。使用此方法存储帧来创建自己的动画类是否不好C++ 文件夹中的文件数,c++,animation,loading,blender,C++,Animation,Loading,Blender,是否有一种特定的方法可以直接获取给定文件夹中的文件数? 比如: 还是我必须打开文件夹并遍历所有文件 我正在从Blender读取obj文件,并尝试加载动画。(大量顶点,每帧1个文件) 还有,为了表现。。。使用此方法存储帧来创建自己的动画类是否不好 vector <vector <float>> frames; vector <float> verticesForThisFrame; verticesForThisFrame.push_back(readX());
vector <vector <float>> frames;
vector <float> verticesForThisFrame;
verticesForThisFrame.push_back(readX());
verticesForThisFrame.push_back(readY());
verticesForThisFrame.push_back(readZ());
frames.push_back(verticesForThisFrame);
矢量帧;
该框架的向量垂直;
此框架的垂直方向。向后推(readX());
此框架的垂直方向。向后推(就绪();
此框架的垂直方向。向后推(readZ());
框架。向后推(该框架的垂直方向);
如果效率很低,你建议我怎么做
编辑:我使用SDL打开窗口,使用OpenGL打开图形。这取决于您使用的框架/库。您可能会被迫打开文件夹并遍历其内容,如
for( directory_iterator it(YourPath); it != directory_iterator(); ++it)
{
// increment variable here
}
在boost的情况下,或者像
QDir.count() // returns the total count of files and directories in the directory
// use flags QDir::Filters with QDir::NoDotAndDotDot to exclude
// . and ..
在Qt的情况下 操作系统不提供此类系统调用。因此,您必须打开目录并读取文件数。我建议您将问题一分为二。就看标题,我想没有搅拌机专家会注意到。啊,好的。谢谢嘿嘿,对不起。我忘了写那个。我使用SDL打开一个窗口。然后用OpenGL进行图形显示。
QDir.count() // returns the total count of files and directories in the directory
// use flags QDir::Filters with QDir::NoDotAndDotDot to exclude
// . and ..