目录扫描代码 [英] Directory Scanning code

查看:77
本文介绍了目录扫描代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

我想知道VC中的目录扫描代码.
我有一个放置大约50个文件的文件夹,我想在该文件夹上应用目录扫描代码,逐步选择一个文件并创建放置文件,然后将其放置在同一文件夹或任何其他一个不同的文件夹中

请帮助

问候

Hi All

i want to know the directory scanning code in VC .
i have a folder in which approximately 50 files are placed i want to apply directory scanning code on the folder that step by step pick one file and create out put file and place it in the same folder or in any other one different folder

Plz Help

Regards

推荐答案

由于您未指定VC以外的任何技术堆栈,因此我不得不在这里假设您正在谈论在MFC中使用MFC. Visual C ++.

幸运的是,由于使用了CFileFind类,因此在Visual C ++中扫描目录非常简单.基本上,您需要为它提供使用以下类中的方法搜索和迭代文件的模式:
As you haven''t specified any technology stack other than VC, I''m going to have to assume here that you are talking about using MFC in Visual C++.

Fortunately, scanning directories in Visual C++ is incredibly trivial thanks to the CFileFind class. Basically, you need to give it the pattern to search for and iterate over the files using the methods in the class like this:
CFileFind find;
BOOL found = find.FindFile("*.txt");
while (found)
{
  found = find.FindNextFile();
}


这篇关于目录扫描代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆