I am using MFC CFindFIle for searching specific .dat file within the given search directory and I need to output the filepath and filename of the files that match the search criteria in the console (cout). It works, but returns strange results in console:
01E73500:000AB810:01E77558
01E77F40:000AB810:01E77FD0
01E740C8:01EA7478:01EA1D00
01EB78C8:01ECAA80:01EAF240
Press any key to continue . . .
Why is the output formatted in hex? Locale issues or something else? Code is running on win 7 64bit, en_us locale.
I am using the following code for searching
void Recurse(LPCTSTR pstr)
{
CFileFind finder;
// build a string with wildcards
CString strWildcard(pstr);
strWildcard += _T("\\*.dat");
// 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.GetFileName());
cout << str << endl;
Recurse(str);
}
else {
CString sFilePath(finder.GetFilePath());
CString sFileName(finder.GetFileName());
//CString sFileTitle(finder.GetFileTitle());
cout << sFilePath << ":" << sFileName << ":" << endl;
}
}
finder.Close();
}