If I create a directory that contains "Hello.txt" then the following code will output "Hello.txt":
#include <windows.h>
#include <iostream>
int _tmain(int argc, _TCHAR* argv[])
{
WIN32_FIND_DATA findData = {};
HANDLE hFind = ::FindFirstFile(L"<.txt", &findData);
if (hFind != INVALID_HANDLE_VALUE)
{
std::wcout << findData.cFileName << std::endl;
while (::FindNextFile(hFind, &findData))
{
std::wcout << findData.cFileName << std::endl;
}
::CloseHandle(hFind);
}
else
{
std::wcout << "FindFirstFile: " << ::GetLastError() << std::endl;
}
return 0;
}
But why does "<" act like "*" in the call to FindFirstFile
?
MSDN says that only wild card charterers are valid in this call (i.e ? or *).
https://msdn.microsoft.com/en-us/library/windows/desktop/aa364418%28v=vs.85%29.aspx
Edit:
Seems to be very related FindFirstFile undocumented wildcard or bug?