CFileFind



I am running a search for audio files that contain a given word in their
names. In the case of the example provided here, there is only one filename
containing "Ay.", and that is the file "Ay." (Ay..ogg). But after my
wildcard search finds that file, it advances past it, so that
FindNextFile( ) leaves me with no results. So actually, the same problem
occurs with my successful searches. I never get to use the first file
found.

Would someone mind steering me into a better methodology here?

CString word = _T("Ay.");
CString s = GetFolderPath( )
+ _T("\\*")
+ word
+ _T("*")
+ _T(".ogg");

CFileFind file;
if(!file.FindFile(s) )
file.Close();

while(file.FindNextFile() )
filearray.Add(file.GetFilePath());

file.Close();


.