Pre {Line-Height: 1; color: #9f1d66; Background-color: # cfe4e4; font-size: 16px ;}. sysfunc {color: # 5d57ff; font-style: italic; font-weight: bold ;}. selffuc {color: #8e0ed3 ;}. bool {color: #008000 ;}. condition {color: #008000; font-weight: bold ;}. key {color: #440080 ;}. vaR {color: #008000; font-style: italic ;}. digit {color: #000080; font-weight: bold ;}. includepre {color: # 661d9f ;}. operator? {Color: # fd1a53; font-weight: bold ;}
Use the cfindfile class ,? This class is mainly used to find files. First call? Findfile ()? Function ?, To start the search process, and then call findnextfile to obtain the subsequent file information.
Note :? This class cannot be compiled successfully in the vs console. It can only be run in MFC.
??? The description in msdn is :? Call? This? Member? Function? To? Open? A? File? Search. Virtual? Bool? Findfile (??? Lpctstr? Pstrname? =? Null ,??? DWORD? Dwunused? =? 0 ?);
Example:
?Example?This?small?program?recurses?every?directory?on?the?C:/?drive?and?prints?the?name?of?the?directory.#include?<afxwin.h>#include?<iostream>using?namespace?std;void?Recurse(LPCTSTR?pstr){???CFileFind?finder;???//?build?a?string?with?wildcards???CString?strWildcard(pstr);???strWildcard?+=?_T("//*.*");???//?start?working?for?files???BOOL?bWorking?=?finder.FindFile(strWildcard);???while?(bWorking)???{??????bWorking?=?finder.FindNextFile();??????//?skip?.?and?..?files;?otherwise,?we‘d??????//?recur?infinitely!??????if?(finder.IsDots())?????????continue;??????//?if?it‘s?a?directory,?recursively?search?it??????if?(finder.IsDirectory())??????{?????????CString?str?=?finder.GetFilePath();?????????cout?<<?(LPCTSTR)?str?<<?endl;?????????Recurse(str);??????}???}???finder.Close();}int?main(){???if?(!AfxWinInit(GetModuleHandle(NULL),?NULL,?GetCommandLine(),?0))??????cout?<<?"panic!"?<<?endl;???else??????Recurse(_T("C:"));}??
Other network materials:
Are there many optimization software available? Are you deleting? System redundancy files? What is the name of the LJ file? Displayed in a list? For deletion.
This uses the technology of traversing all files in a folder .? So it's like writing one by yourself .? But I have never touched it before? So I checked msdn? Input? Does findfile have such a function? Do you still have code instances? Slightly changed the code? If you want to modify it again? Can it be used to delete a specific set of files or a software for deleting the system LJ? It's time for everyone to make full use of their imagination.
This function is described as follows:
Call?this?member?function?to?open?a?file?search.virtual?BOOL?FindFile(LPCTSTR?pstrName?=?NULL,DWORD?dwUnused?=?0);After?calling?FindFile?to?begin?the?file?search,?call?FindNextFile?to?retrieve?subsequent?files.?You?must?call?FindNextFile?at?least?once?before?calling?any?of?the?following?attribute?member?functions:
This function is used to start a file search. After finding the file, you can call findnextfile to find a group of files consecutively.
?
# Include? <Afxwin. h> # include? <Iostream> using? Namespace? STD; void? Recurse (lpctstr? Pstr ){??? Cfilefind? Finder ;?? //? Build? A? String? With? Wildcards ??? Cstring? Strwildcard (pstr );??? Strwildcard? + =? _ T ("//*.*");?? //? Start? Working? For? Files ?? Bool? Bworking? =? Finder. findfile (strwildcard );?? While? (Bworking )?? {??????? Bworking? =? Finder. findnextfile ();?????? //? Skip ?.? And ?..? Files ;? Otherwise ,? We 'd ?????? //? Recur? Infinitely !?????? If? (Finder. isdots ())???????? Continue ;??????????? Cstring? Sfilename? =? Finder. getfilename ();?????????? Cout? <? (Lpctstr) sfilename? <? Endl; // output all file names in the search folder ??}??? Finder. Close ();} Int? Main (){?? If? (! Afxwininit (getmodulehandle (null ),? Null ,? Getcommandline (),? 0) // initialize MFC ?????? Cout? <? "Panic! "? <? Endl ;?? Else ??????? Recurse (_ T ("C :"));???????? Return? 0 ;}
Used in this article? Calligraphy and painting novel software? Released, the content has nothing to do with the software, and the painting and calligraphy novel software? More comfortable reading, more comfortable writing, and easier Publishing.
Search for files in the specified directory ?. XML