Home > Back-end >  Novice to solve
Novice to solve

Time:10-06

Cstrings strdir;
CFileFind Finder.
Strdir=_T (" C: \ \ ske ");//DataDir for operating file directory
Cstrings strTmp;
int a=0;
Cstrings fileExt;
Bool bWorking;
BWorking=Finder. FindFile (strdir + "\ \ *. *");
While (bWorking)
{
BWorking=Finder. The FindNextFile ();
If (Finder. IsDots ())//if the file name. Or.. It is the current directory and superior directory
{
continue;
}
Else if (Finder. IsDirectory ())//if it is a directory
{
StrTmp=Finder. GetFilePath ();
FInder. FindFile (strTmp + "\ \ *. *");
}
The else
{
Cstrings fileName=Finder. GetFileName ();
Int dotPos=fileName. ReverseFind (');
FileExt=fileName. Right (fileName. GetLength () - dotPos);
If (fileExt==_T (". TXT "))
{
Filename [a]=Finder. GetFileName ();//GetFileName: get with suffix filename
If (Finder. GetLastWriteTime (refTime))
{
Filetime [a]=refTime. The Format (_T (" % c "));
}
a++;
}
}
}

This code can only to 1 subdirectory TXT file, how to change to achieve get subdirectories in a directory file

CodePudding user response:

Are generally adopted the practice of recursive calls
  • Related